supercronic icon indicating copy to clipboard operation
supercronic copied to clipboard

Configure pre-commit-hooks.yaml

Open jcomo opened this issue 3 years ago • 0 comments

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.yaml file 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 runs go 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 -test flag. 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.

jcomo avatar Dec 30 '22 00:12 jcomo