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

add enforce option and pre-commit hook #22

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

drmorr0
Copy link

@drmorr0 drmorr0 commented Jun 15, 2023

This PR adds an -enforce option to go-carpet that makes the executable return 1 if any file has coverage under the specified -mincov value. It also adds a .pre-commit-hooks.yaml file and a .pre-commit-runner.sh which lets users perform coverage checks as a part of pre-commit.

There's a funny quirk with how pre-commit passes arguments to executables: it just specifies a list of (space-separated) arguments, followed by a list of (space-separated) file names to check. If we want users to be able to customize the -mincov value (or pass any other arguments in) for go-carpet, we need to have some way to differentiate between an "argument" and a "filename".

The best I've been able to come up with is to check for arguments that start with a - character. These are treated as arguments to go-carpet, and everything else gets concatenated together as a list of files.

Please let me know what you think, or if you have any suggestions/concerns!

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

Successfully merging this pull request may close these issues.

None yet

1 participant