Add --no-allow-missing-config option to init-templatedir#1539
Merged
asottile merged 1 commit intopre-commit:masterfrom Jul 21, 2020
Merged
Add --no-allow-missing-config option to init-templatedir#1539asottile merged 1 commit intopre-commit:masterfrom
asottile merged 1 commit intopre-commit:masterfrom
Conversation
asottile
reviewed
Jul 21, 2020
Member
asottile
left a comment
There was a problem hiding this comment.
still seems a little odd, it's very unlikely that you'll never clone a repo without pre-commit 🤔
Member
|
I'm fine adding the option, let's remove the warning though |
Add a `--no-allow-missing-config` option to the `init-templatedir` command. Enable configuration of a Git template that requires newly cloned repos to have a `pre-commit` config.
56bf3b4 to
1b435f1
Compare
Contributor
Author
Thanks! It's too bad you figured out I'm actually a dog, though. |
Member
woof, woof woof! WOOF woof! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

The hook template created by
pre-commit init-templatediracts like it was installed bypre-commit install --allow-missing-config. That behavior makes sense for most people: if you're working with some repos that have pre-commit and some that don't, it's annoying to uninstall pre-commit from the repos that don't use it. However, for people trying to adopt a policy of using pre-commit in every repo, it's easier to catch repos that are missing the config if pre-commit fails hard.To support this special case, add a
--no-allow-missing-configoption to theinit-templatedircommand. When that option is set, create a template hook that fails in repos where the pre-commit config is missing.