Skip to content

Add --no-allow-missing-config option to init-templatedir#1539

Merged
asottile merged 1 commit intopre-commit:masterfrom
singergr-ctds:feat/no-allow-missing-config
Jul 21, 2020
Merged

Add --no-allow-missing-config option to init-templatedir#1539
asottile merged 1 commit intopre-commit:masterfrom
singergr-ctds:feat/no-allow-missing-config

Conversation

@singergr-ctds
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread pre_commit/commands/init_templatedir.py Outdated
@asottile
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 feat/no-allow-missing-config branch from 56bf3b4 to 1b435f1 Compare July 21, 2020 02:02
@asottile asottile merged commit c0f750d into pre-commit:master Jul 21, 2020
@singergr-ctds
Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Member

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants