-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create a standard pre-commit hook to require safe attribute #39
Comments
This is great, and I think that this would be worthwhile to include even in its crude state. It's sufficient for my purposes. If people find it too finnicky, we'll be happy for contributions to fix that up, otherwise it'll solve a very common problem in an obvious way. |
Closed
ryanhiebert
added a commit
that referenced
this issue
Sep 12, 2023
This pre-commit hook checks the migration files in the current repository and ensures that they all have a `safe` property defined. While we can think of easy ways to be break this, for all the use-cases I've had this covers it quite nicely, so I think it's worth merging even if we think it's a bit rough. Tim Schilling wrote this in #39 and I'm very happy to take that almost verbatim and prove it. The only thing I changed was to make a new function to handle sys.exit(), so that I could set it as a console_script to use with pre-commit.
ryanhiebert
added a commit
that referenced
this issue
Sep 12, 2023
This pre-commit hook checks the migration files in the current repository and ensures that they all have a `safe` property defined. While we can think of easy ways to be break this, for all the use-cases I've had this covers it quite nicely, so I think it's worth merging even if we think it's a bit rough. Tim Schilling wrote this in #39 and I'm very happy to take that almost verbatim and prove it. The only thing I changed was to make a new function to handle sys.exit(), so that I could set it as a console_script to use with pre-commit. Co-authored-by: Tim Schilling <schillingt@better-simple.com>
ryanhiebert
added a commit
that referenced
this issue
Sep 13, 2023
Check the migrations files in the current repository and ensure that they all have a `safe` property defined. While we can think of easy ways to break this implementation, for all the use-cases I've had this covers it quite nicely so I think it's worth merging even if its rough. Tim Schilling put an initial sketch of this in #39 and I was able to modify it for use in a precommit hook without difficulty. The modifications were made to tailor it to the environment of pre-commit, where file names are passed to the command as arguments. This allows pre-commit to only need to run the checks incrementally for the affected files for new commits. Co-authored-by: Tim Schilling <schillingt@better-simple.com>
ryanhiebert
added a commit
that referenced
this issue
Sep 13, 2023
Check the migrations files in the current repository and ensure that they all have a `safe` property defined. While we can think of easy ways to break this implementation, for all the use-cases I've had this covers it quite nicely so I think it's worth merging even if its rough. Tim Schilling put an initial sketch of this in #39 and I was able to modify it for use in a precommit hook without difficulty. The modifications were made to tailor it to the environment of pre-commit, where file names are passed to the command as arguments. This allows pre-commit to only need to run the checks incrementally for the affected files for new commits. Co-authored-by: Tim Schilling <schillingt@better-simple.com>
ryanhiebert
added a commit
that referenced
this issue
Sep 13, 2023
Check the migrations files in the current repository and ensure that they all have a `safe` property defined. While we can think of easy ways to break this implementation, for all the use-cases I've had this covers it quite nicely so I think it's worth merging even if its rough. Tim Schilling put an initial sketch of this in #39 and I was able to modify it for use in a precommit hook without difficulty. The modifications were made to tailor it to the environment of pre-commit, where file names are passed to the command as arguments. This allows pre-commit to only need to run the checks incrementally for the affected files for new commits. Co-authored-by: Tim Schilling <schillingt@better-simple.com>
ryanhiebert
added a commit
that referenced
this issue
Sep 13, 2023
Check the migrations files in the current repository and ensure that they all have a `safe` property defined. While we can think of easy ways to break this implementation, for all the use-cases I've had this covers it quite nicely so I think it's worth merging even if its rough. Tim Schilling put an initial sketch of this in #39 and I was able to modify it for use in a precommit hook without difficulty. The modifications were made to tailor it to the environment of pre-commit, where file names are passed to the command as arguments. This allows pre-commit to only need to run the checks incrementally for the affected files for new commits. Co-authored-by: Tim Schilling <schillingt@better-simple.com>
Merged
ryanhiebert
added a commit
that referenced
this issue
Sep 13, 2023
Check the migrations files in the current repository and ensure that they all have a `safe` property defined. While we can think of easy ways to break this implementation, for all the use-cases I've had this covers it quite nicely so I think it's worth merging even if its rough. Tim Schilling put an initial sketch of this in #39 and I was able to modify it for use in a precommit hook without difficulty. The modifications were made to tailor it to the environment of pre-commit, where file names are passed to the command as arguments. This allows pre-commit to only need to run the checks incrementally for the affected files for new commits. Co-authored-by: Tim Schilling <schillingt@better-simple.com>
ryanhiebert
added a commit
that referenced
this issue
Sep 13, 2023
* Add pre-commit hook Check the migrations files in the current repository and ensure that they all have a `safe` property defined. While we can think of easy ways to break this implementation, for all the use-cases I've had this covers it quite nicely so I think it's worth merging even if its rough. Tim Schilling put an initial sketch of this in #39 and I was able to modify it for use in a precommit hook without difficulty. The modifications were made to tailor it to the environment of pre-commit, where file names are passed to the command as arguments. This allows pre-commit to only need to run the checks incrementally for the affected files for new commits. Co-authored-by: Tim Schilling <schillingt@better-simple.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We wrote a simple regex pre-commit hook that's extremely crude. It works well enough for us, but the library should probably have something a bit better.
Then in the yaml:
The text was updated successfully, but these errors were encountered: