-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
style: disable NewFormulaAudit cops' execution by default unless specified #2906
style: disable NewFormulaAudit cops' execution by default unless specified #2906
Conversation
Library/.rubocop.yml
Outdated
@@ -28,7 +28,7 @@ FormulaAuditStrict/Options: | |||
Enabled: true | |||
|
|||
NewFormulaAudit/Options: | |||
Enabled: false | |||
Enabled: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still won't quite work because it'll show up in files when using e.g. rubocop
in my editor. Need some way to have it be disabled by default and enabled only when requested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems tricky to achieve. But I'll try to think of someway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MikeMcQuaid One way that works involves some redundant configuration. (Redundant because we are doing similar thing in brew style
, but it has to be redundant because brew
and rubocop
run in different processes and aren't as such coupled and editor integration is independent of brew
)
In sublime, we can add args
line in Sublime Linter User Settings (found in Menu->Preferences->Package Settings->SublimeLinter->Settings - User
) so final rubocop
section should look like below
"rubocop": {
"@disable": false,
"args": ["--except", "FormulaAuditStrict, NewFormulaAudit"],
"excludes": []
}
If we are planning to go by this method, It would be better to update our docs to have a section on editor integration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GauthamGoli I think we need to have something that involves zero configuration. Is there any way to have a cop that's only run when specified on the command-line? There may be some hack using a global ARGV
check or similar in the cop itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
Example: #569 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GauthamGoli Worst case we can run the new formulae cops in a separate rubocop
invocation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The editor plugin finds .rubocop.yml
file at HOMEBREW_LIBRARY
and uses it to highlight violations.
So, in HOMEBREW_LIBRARY/.rubocop.yml
,FormulaAuditStrict
and NewFormulaAudit
departments can be disabled. This configuration can be inherited and overriden in another configuration file with the former departments(or specific cops) enabled, which will now be used in style.rb
to handle brew audit
and brew style
commands.
This also achieves the zero configuration goal for end user/developer. I can push it here if you want to see this approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think FormulaAuditStrict
are fine to leave enabled by default and we just have a separate configuration file for NewFormulaAudit
. That could be useful for enforcing things like e.g. 80 character wrapping, too.
@MikeMcQuaid |
I think it's worth just enabling/disabling cops based on their namespace rather than enabling each one individually. What do you think? |
Yeah, agree. |
8640da8
to
086e540
Compare
This seems to be a be in general a good approach. We just need to make certain that this won't accidentally trigger unwanted strict/new formula, audits/style checks on the To that end, cc @ilovezfs |
Tried that and it's looking 👍 so 🚢! |
brew tests
with your changes locally?The
NewFormulaAudit
cop got enabled for all Formulae because I forgot to disable it forbrew style
( I disabled forbrew audit
) in #2905, This PR fixes that mistake.