From 5b3231ea0ab23aae7c552142049e99afe0d72b4b Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Sat, 15 Jul 2017 22:40:26 +0530 Subject: [PATCH 1/2] style: disable NewFormulaAudit cops' execution by default unless specified --- Library/.rubocop.yml | 2 +- Library/Homebrew/cmd/style.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index fd42fd0238..2d22fe4f80 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -28,7 +28,7 @@ FormulaAuditStrict/Options: Enabled: true NewFormulaAudit/Options: - Enabled: false + Enabled: true FormulaAuditStrict/BottleBlock: Enabled: true diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index 7158fe5b98..14499f24bd 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -47,7 +47,9 @@ module Homebrew elsif !except_cops.empty? options[:except_cops] = except_cops elsif only_cops.empty? && except_cops.empty? - options[:except_cops] = %w[FormulaAuditStrict FormulaAudit] + options[:except_cops] = %w[FormulaAudit + FormulaAuditStrict + NewFormulaAudit] end Homebrew.failed = check_style_and_print(target, options) From 086e540231691bca054b70e79ec37cc344b14d37 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Tue, 18 Jul 2017 19:10:12 +0530 Subject: [PATCH 2/2] Add a rubocop config file to control cops' execution in audit and style --- Library/.auditcops.yml | 5 +++ Library/.rubocop.yml | 41 +++---------------------- Library/Homebrew/cmd/style.rb | 2 +- Library/Homebrew/test/cmd/style_spec.rb | 4 +-- 4 files changed, 12 insertions(+), 40 deletions(-) create mode 100644 Library/.auditcops.yml diff --git a/Library/.auditcops.yml b/Library/.auditcops.yml new file mode 100644 index 0000000000..b5b7a8b581 --- /dev/null +++ b/Library/.auditcops.yml @@ -0,0 +1,5 @@ +inherit_from: + - ./.rubocop.yml + +NewFormulaAudit: + Enabled: true diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 2d22fe4f80..cb065a1a4b 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -6,47 +6,14 @@ AllCops: require: ./Homebrew/rubocops.rb -FormulaAudit/Text: +FormulaAudit: Enabled: true -FormulaAudit/Caveats: +FormulaAuditStrict: Enabled: true -FormulaAudit/Checksum: - Enabled: true - -FormulaAudit/ChecksumCase: - Enabled: true - -FormulaAudit/Conflicts: - Enabled: true - -FormulaAudit/Options: - Enabled: true - -FormulaAuditStrict/Options: - Enabled: true - -NewFormulaAudit/Options: - Enabled: true - -FormulaAuditStrict/BottleBlock: - Enabled: true - -FormulaAuditStrict/Desc: - Enabled: true - -FormulaAuditStrict/ComponentsOrder: - Enabled: true - -FormulaAuditStrict/ComponentsRedundancy: - Enabled: true - -FormulaAudit/Homepage: - Enabled: true - -FormulaAudit/LegacyPatches: - Enabled: true +NewFormulaAudit: + Enabled: false # `system` is a special case and aligns on second argument Layout/AlignParameters: diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index 14499f24bd..b0f46fadc4 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -109,7 +109,7 @@ module Homebrew args << "--config" << HOMEBREW_LIBRARY_PATH/".rubocop.yml" args << HOMEBREW_LIBRARY_PATH else - args << "--config" << HOMEBREW_LIBRARY/".rubocop.yml" + args << "--config" << HOMEBREW_LIBRARY/".auditcops.yml" args += files end diff --git a/Library/Homebrew/test/cmd/style_spec.rb b/Library/Homebrew/test/cmd/style_spec.rb index 3c4c3f8099..4701036f10 100644 --- a/Library/Homebrew/test/cmd/style_spec.rb +++ b/Library/Homebrew/test/cmd/style_spec.rb @@ -4,12 +4,12 @@ describe "brew style" do around(:each) do |example| begin 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 ensure FileUtils.rm_f HOMEBREW_LIBRARY/"Homebrew" - FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop.yml" + FileUtils.rm_f HOMEBREW_LIBRARY/".auditcops.yml" end end