-
Notifications
You must be signed in to change notification settings - Fork 65
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
Adds allow_list_rules setting for configs. #184
Conversation
All pass locally. Are the issues unrelated here? |
@lisroach the windows failures are because of the multiline strings with escaped newlines. It's using the git mode that checks it out with dos newlines, so instead of I think elsewhere in fixit and libcst they use textwrap.dedent and just use an indented multiline string. I think blank lines are allowed in yaml, so could just omit the backslash too. |
Codecov Report
@@ Coverage Diff @@
## master #184 +/- ##
==========================================
+ Coverage 86.03% 86.19% +0.15%
==========================================
Files 91 91
Lines 3703 3744 +41
==========================================
+ Hits 3186 3227 +41
Misses 517 517
Continue to review full report at Codecov.
|
#187 for the Pyre error |
#190 for the autofix errors. |
I'm not sure if block_list_rules should always take precedence when it comes to inheritance. Say a new lint is being rolled out that has a high impact area. A team may want to turn it off by default for their directory but enable it gradually in subdirectories. I think that as part of the inheritance, it may make sense to override the block / allow list in tandem. That is, each key / rule should only exist in at most one of those lists. Thus, when a sub-directory's config allow lists a previously block listed rule, the inheritance should recognize and remove the pre-existing block on the rule. |
@williamlw999-fb interesting point! My main reasoning behind the ability for One thing I think you might be misunderstanding is that a rule is not on by default if it does not exist in the So if a parent config looks like:
and a new rule named YourRule comes out, YourRule would not be on for the subdirs. It is only on if it is added to The one thing I don't like about this is if you have:
and you roll out YourRule, in this case YourRule is on everywhere. I would like to require |
I'm going to merge this PR to unblock myself, I am happy to have more discussion on this and we can make changes before the next FixIt release if the current way isn't working. |
Summary
Adds a new setting
allow_list_rules
that enables setting specific rules as "on". This solves a couple things:If
allow_list_rules
is left out of a config or set to[]
it defaults to allow all to keep backwards compatibility.Test Plan
Added new unit tests. Also updated the docs.