Skip to content

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.

1 participant