Configure pre-commit-hooks.yaml #115
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We use pre-commit to run a series of linters/fixers against our code before we land diffs in the main branch. I've put together a simple integration for pre-commit for supercronic, and was wondering if this would be something that's useful to merge into upstream.
In order to define a linter, a
.pre-commit-hooks.yamlfile needs to be added to the root of the repo, and - depending on the language - an environment will be automatically set up to run the linter. In this case, the golang environment runsgo install ./..., so we can use the supercronic binary as-is.Other than adding the hooks config file, the main change in this PR is to allow multiple filenames to be passed in combination with the
-testflag. This is how pre-commit works: it sends the list of files to the entrypoint as args.By default, I've configured the pre-commit hook to look changes to files with
.crontab, but users can override this in their own repo configs.Let me know if this is something you'd want to merge in. No worries if not -- happy to close this PR if it's not relevant, and we'll continue to use the fork.