Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[idea] Integrate with pre-commit #47

Open
sloria opened this issue Sep 22, 2018 · 7 comments
Open

[idea] Integrate with pre-commit #47

sloria opened this issue Sep 22, 2018 · 7 comments

Comments

@sloria
Copy link

sloria commented Sep 22, 2018

Nice work on this project! I've been looking for something like it for some time.

I'm wondering if the bot could be configured to run pre-commit. That way, it could do more than just format with black.

pre-commit + a GitHub bot would ensure that unformatted code never gets merged, and would take the burden off maintainers and contributors.

In an ideal world, unformatted code never gets committed because pre-commit prevents it. In a realistic world, contributors may forget to install the pre-commit hooks. The black_out bot would be the last resort, making the formatting commit for you.

@webknjaz
Copy link

@sloria pre-commit's hooks (I assume you're talking about pre-commit.com tool) don't always do changes, that's why I guess it's hard to use it for such a thing.

@sloria
Copy link
Author

sloria commented Oct 13, 2018

@webknjaz Yes, I was referring to pre-commit.com. I'm not sure what you mean--running pre-commit run --all-files will modify files in place.

@webknjaz
Copy link

Err.. not exactly. It will run hooks and those hooks may modify files if they are programmed to do so. Most of "hooks" there are linters, not autoformatters. Which conflicts with your statement a bit.

@sloria
Copy link
Author

sloria commented Oct 14, 2018

I don't see that as a blocker to implementing this feature, though.

It is common to run black through pre-commit, but not all projects use the black coding style. marshmallow, for example, currently uses pre-commit for formatting but does not use black: https://github.com/marshmallow-code/marshmallow/blob/dev/.pre-commit-config.yaml

@webknjaz
Copy link

Okay, I see where you're going with this. Makes sense.

@Mariatta
Copy link
Owner

Mariatta commented Nov 2, 2018

Sorry for the late in responding. I've been out of open source for the past two months, and just saw this now.

So I've created this bot because I don't want to bother with pre-commit and all that, but I think there was another suggestion in the past for integrating additional services other than black. I will think more about this.

@sloria
Copy link
Author

sloria commented Nov 2, 2018

No worries!

Yeah, it makes sense why you'd want to use a bot for formatting. Integrating with pre-commit would generalize the tool a beyond black (and even beyond Python).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants