Merge pull request #2906 from GauthamGoli/new_formula_rubocop_fix

style: disable NewFormulaAudit cops' execution by default unless specified
This commit is contained in:
Mike McQuaid 2017-07-21 14:41:40 +01:00 committed by GitHub
commit 9747bc397a
4 changed files with 14 additions and 40 deletions

5
Library/.auditcops.yml Normal file
View File

@ -0,0 +1,5 @@
inherit_from:
- ./.rubocop.yml
NewFormulaAudit:
Enabled: true

View File

@ -6,48 +6,15 @@ AllCops:
require: ./Homebrew/rubocops.rb require: ./Homebrew/rubocops.rb
FormulaAudit/Text: FormulaAudit:
Enabled: true Enabled: true
FormulaAudit/Caveats: FormulaAuditStrict:
Enabled: true Enabled: true
FormulaAudit/Checksum: NewFormulaAudit:
Enabled: true
FormulaAudit/ChecksumCase:
Enabled: true
FormulaAudit/Conflicts:
Enabled: true
FormulaAudit/Options:
Enabled: true
FormulaAuditStrict/Options:
Enabled: true
NewFormulaAudit/Options:
Enabled: false Enabled: false
FormulaAuditStrict/BottleBlock:
Enabled: true
FormulaAuditStrict/Desc:
Enabled: true
FormulaAuditStrict/ComponentsOrder:
Enabled: true
FormulaAuditStrict/ComponentsRedundancy:
Enabled: true
FormulaAudit/Homepage:
Enabled: true
FormulaAudit/LegacyPatches:
Enabled: true
# `system` is a special case and aligns on second argument # `system` is a special case and aligns on second argument
Layout/AlignParameters: Layout/AlignParameters:
Enabled: false Enabled: false

View File

@ -47,7 +47,9 @@ module Homebrew
elsif !except_cops.empty? elsif !except_cops.empty?
options[:except_cops] = except_cops options[:except_cops] = except_cops
elsif only_cops.empty? && except_cops.empty? elsif only_cops.empty? && except_cops.empty?
options[:except_cops] = %w[FormulaAuditStrict FormulaAudit] options[:except_cops] = %w[FormulaAudit
FormulaAuditStrict
NewFormulaAudit]
end end
Homebrew.failed = check_style_and_print(target, options) Homebrew.failed = check_style_and_print(target, options)
@ -107,7 +109,7 @@ module Homebrew
args << "--config" << HOMEBREW_LIBRARY_PATH/".rubocop.yml" args << "--config" << HOMEBREW_LIBRARY_PATH/".rubocop.yml"
args << HOMEBREW_LIBRARY_PATH args << HOMEBREW_LIBRARY_PATH
else else
args << "--config" << HOMEBREW_LIBRARY/".rubocop.yml" args << "--config" << HOMEBREW_LIBRARY/".auditcops.yml"
args += files args += files
end end

View File

@ -4,12 +4,12 @@ describe "brew style" do
around(:each) do |example| around(:each) do |example|
begin begin
FileUtils.ln_s HOMEBREW_LIBRARY_PATH, HOMEBREW_LIBRARY/"Homebrew" FileUtils.ln_s HOMEBREW_LIBRARY_PATH, HOMEBREW_LIBRARY/"Homebrew"
FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop.yml", HOMEBREW_LIBRARY/".rubocop.yml" FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop.yml", HOMEBREW_LIBRARY/".auditcops.yml"
example.run example.run
ensure ensure
FileUtils.rm_f HOMEBREW_LIBRARY/"Homebrew" FileUtils.rm_f HOMEBREW_LIBRARY/"Homebrew"
FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop.yml" FileUtils.rm_f HOMEBREW_LIBRARY/".auditcops.yml"
end end
end end