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 --no-allow-missing-config option to init-templatedir #1539

Merged
merged 1 commit into from Jul 21, 2020

Conversation

@singergr
Copy link
Contributor

@singergr singergr commented Jul 21, 2020

The hook template created by pre-commit init-templatedir acts like it was installed by pre-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-config option to the init-templatedir command. When that option is set, create a template hook that fails in repos where the pre-commit config is missing.

Copy link
Member

@asottile asottile left a comment

still seems a little odd, it's very unlikely that you'll never clone a repo without pre-commit 🤔

pre_commit/commands/init_templatedir.py Outdated Show resolved Hide resolved
@asottile
Copy link
Member

@asottile asottile commented Jul 21, 2020

I'm fine adding the option, let's remove the warning though

Copy link
Member

@asottile asottile left a comment

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.
@asottile asottile force-pushed the singergr:feat/no-allow-missing-config branch from 56bf3b4 to 1b435f1 Jul 21, 2020
@asottile asottile merged commit c0f750d into pre-commit:master Jul 21, 2020
1 check passed
1 check passed
pre-commit.pre-commit #20200721.3 succeeded
Details
@singergr
Copy link
Contributor Author

@singergr singergr commented Jul 21, 2020

I'm fine adding the option, let's remove the warning though

Thanks! It's too bad you figured out I'm actually a dog, though.

@asottile
Copy link
Member

@asottile asottile commented Jul 21, 2020

I'm fine adding the option, let's remove the warning though

Thanks! It's too bad you figured out I'm actually a dog, though.

woof, woof woof! WOOF woof!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.