-
Notifications
You must be signed in to change notification settings - Fork 410
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
Added pre-commit integration. #556
Conversation
Thanks for the PR, but I don't quite understand why this pre-commit configuration file should be part of this repository. There can be many tools which might want to use this library. The library itself should not need to include code to cater for each of these tools. Specifically this library provides two well-established API-s:
So far these have been enough for all kinds of tools to integrate with it. |
It just simplifies And it will not require everyone to have a separate repository for that (like I created). There are more than 200+ popular projects that added integration with the pre-commit hooks already. |
Sorry, but I don't buy it. To me it looks like a shortcoming of this pre-commit tool. Also, me being completely unfamiliar with this tool makes me a bad maintainer of that integration. I'd rather not take that responsibility upon me. |
Also, clicking through this list of hooks it seems to me that most of the repositories linked from there are either:
Found a few rare exceptions. So it looks like adding of this config file might be a standard practice in the world of Python, but a pretty rare thing outside of Python realm. |
It would really be nice to have it integrated with pre-commit. I am sadly not able to use this tool otherwise. sqlfluff could become a nice alternative for me - but it seems to be very unstable in the way it parses grammar, which renders it useless. |
This thread has good points pro adding this single config file. This may even encourage @nene to reconsider 😄 To make it easier for the readers, @asottile mentions eslint and ruboco as examples of off-Python world projects where pre-commit is very well welcomed. |
Why not simply use pre-commit-sql-formatter? I guess the problem is that these small wrapper-projects become easily out of date with the original library as they need to reference a specific version of the library, unlike when the configuration file is part of the original library repo (at least it seems that a version number is required in the former case, but not in the latter case). |
This indeed looks valid. In addition, one needs to maintain an irrelevant version tag to fetch a hook from a third-party repo. |
OK. I'll merge this in, as there are at least two people interested in this and it doesn't seem to require any additional maintenance from my side. |
This PR introduces direct pre-commit compatibility.
Here is an example of how it can be integrated after it will be integrated:
Right now you need to create a separate repository in order to be able to integrate with
sql-formatter
.Like this one: https://github.com/slyapustin/pre-commit-sql-formatter