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

OPT_OUT in environment should override .opt-in file #219

Open
gthb opened this issue Jan 23, 2021 · 3 comments
Open

OPT_OUT in environment should override .opt-in file #219

gthb opened this issue Jan 23, 2021 · 3 comments

Comments

@gthb
Copy link

gthb commented Jan 23, 2021

Having opted in with an .opt-in file, I should then still be able to opt out for individual commands with an OPT_OUT=pre-commit environment variable. Right now the OPT_OUT environment variable does not override the .opt-in file.

@ta2edchimp
Copy link
Owner

@gthb

Do you have a particular use case for this or is this a theoretical case?
Originally, the functionality was intentionally limited to having commands from which a user can opt out from (or opt into); and to do so in a "flat" manner (that is, only creating a single local source of truth to opt into or out of certain commands).

What I thought about, from time to time, for quite some time now and which is now refreshed by this issue you raised, would be to make a v2 release that actually evaluates all the opt in and opt out variables available, in a hierarchical manner (that is: env variable overrides dot-file, which itself overrides package.json config object; opting out of an option on a level overrides opting into it on the same level and below).
Would this align with your idea(s) and/or requirement(s)?


Kveðja til uppáhalds eyjunnar minnar!

@gthb
Copy link
Author

gthb commented Jan 25, 2021

Hæ! Yep, that would align with our requirements, and was the behavior I expected, until I tried it. :)

My use case was that I was introducing a lint-the-modified-files pre-commit hook to my team and proposing that people opt in with an .opt-in file, and then just opt out as needed, case-by-case, with OPT_OUT=pre-commit git commit. E.g. you want to get your work pushed before you hop on the bus you're about to miss, and you're just pushing to a WIP branch anyway so it's harmless. The idea is to ease the concern of “obtrusiveness”, so that the opt-in is an easier sell: “it's easy to skip when needed, so it won't block you, just nudge you.”)

@gthb
Copy link
Author

gthb commented Jan 25, 2021

Kveðja til uppáhalds eyjunnar minnar!

Ég skila því!

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

No branches or pull requests

2 participants