diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index e42b2a0aa4..0446dce95b 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -1,10 +1,4 @@ -AllCops: - TargetRubyVersion: 2.3 - Exclude: - - '**/vendor/**/*' - DisplayCopNames: false - -require: ./Homebrew/rubocops.rb +inherit_from: ./.rubocop_shared.yml # enable all formulae audits FormulaAudit: @@ -14,10 +8,6 @@ FormulaAudit: FormulaAuditStrict: Enabled: true -# enable all cask audits -Cask: - Enabled: true - # disable all formulae strict audits by default NewFormulaAudit: Enabled: false diff --git a/Library/.rubocop_audit.yml b/Library/.rubocop_audit.yml index b5b7a8b581..80c224ca06 100644 --- a/Library/.rubocop_audit.yml +++ b/Library/.rubocop_audit.yml @@ -1,5 +1,4 @@ -inherit_from: - - ./.rubocop.yml +inherit_from: ./.rubocop.yml NewFormulaAudit: Enabled: true diff --git a/Library/.rubocop_cask.yml b/Library/.rubocop_cask.yml new file mode 100644 index 0000000000..d87ccf9014 --- /dev/null +++ b/Library/.rubocop_cask.yml @@ -0,0 +1,96 @@ +inherit_from: ./.rubocop_shared.yml + +# Cask Cops + +Cask/HomepageMatchesUrl: + Description: 'Ensure that the homepage and url match, otherwise add a comment. More info at https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment' + Enabled: true + +Cask/HomepageUrlTrailingSlash: + Description: 'Ensure that the homepage url has a slash after the domain name.' + Enabled: true + +Cask/NoDslVersion: + Description: 'Do not use the deprecated DSL version syntax in your cask header.' + Enabled: true + +Cask/StanzaGrouping: + Description: 'Ensure that cask stanzas are grouped correctly. More info at https://github.com/Homebrew/homebrew-cask/blob/master/CONTRIBUTING.md#stanza-order' + Enabled: true + +Cask/StanzaOrder: + Description: 'Ensure that cask stanzas are sorted correctly. More info at https://github.com/Homebrew/homebrew-cask/blob/master/CONTRIBUTING.md#stanza-order' + Enabled: true + +# Built-In Cops + +Layout/AlignHash: + EnforcedHashRocketStyle: table + EnforcedColonStyle: table + +Layout/IndentArray: + EnforcedStyle: align_brackets + +Layout/IndentHash: + EnforcedStyle: align_braces + +Metrics/BlockLength: + Enabled: false + +Metrics/LineLength: + Enabled: false + +Naming/FileName: + Enabled: false + +Naming/HeredocDelimiterNaming: + Blacklist: + - END, EOD, EOF + +Performance/StringReplacement: + Enabled: false + +Style/BarePercentLiterals: + EnforcedStyle: percent_q + +Style/Documentation: + Enabled: false + +Style/EmptyElse: + Enabled: false + +Style/FrozenStringLiteralComment: + Enabled: false + +Style/HashSyntax: + EnforcedStyle: ruby19_no_mixed_keys + +Style/IfUnlessModifier: + Enabled: false + +Style/PercentLiteralDelimiters: + PreferredDelimiters: + '%': '{}' + '%i': '{}' + '%q': '{}' + '%Q': '{}' + '%r': '{}' + '%s': '()' + '%w': '[]' + '%W': '[]' + '%x': '()' + +Style/RegexpLiteral: + EnforcedStyle: percent_r + +Style/SymbolArray: + EnforcedStyle: brackets + +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: comma + +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: comma + +Style/WordArray: + EnforcedStyle: brackets diff --git a/Library/.rubocop_shared.yml b/Library/.rubocop_shared.yml new file mode 100644 index 0000000000..60ae903bd4 --- /dev/null +++ b/Library/.rubocop_shared.yml @@ -0,0 +1,7 @@ +AllCops: + TargetRubyVersion: 2.3 + Exclude: + - '**/vendor/**/*' + DisplayCopNames: false + +require: ./Homebrew/rubocops.rb diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index da003e380b..b2350c3b94 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -1,5 +1,4 @@ -inherit_from: - - ../.rubocop.yml +inherit_from: ../.rubocop.yml AllCops: Include: diff --git a/Library/Homebrew/cask/cmd/style.rb b/Library/Homebrew/cask/cmd/style.rb index 4ee00422a2..83cd8bff85 100644 --- a/Library/Homebrew/cask/cmd/style.rb +++ b/Library/Homebrew/cask/cmd/style.rb @@ -44,7 +44,7 @@ module Cask def default_args [ "--force-exclusion", - "--config", "#{HOMEBREW_LIBRARY}/.rubocop.yml", + "--config", "#{HOMEBREW_LIBRARY}/.rubocop_cask.yml", "--format", "simple" ] end diff --git a/Library/Homebrew/test/.rubocop.yml b/Library/Homebrew/test/.rubocop.yml index 245653243b..217977e2d4 100644 --- a/Library/Homebrew/test/.rubocop.yml +++ b/Library/Homebrew/test/.rubocop.yml @@ -1,4 +1,4 @@ -inherit_from: +inherit_from: - ../.rubocop.yml - .rubocop_todo.yml diff --git a/Library/Homebrew/test/cmd/style_spec.rb b/Library/Homebrew/test/cmd/style_spec.rb index 4f0edfb7a4..c9e1ac2afc 100644 --- a/Library/Homebrew/test/cmd/style_spec.rb +++ b/Library/Homebrew/test/cmd/style_spec.rb @@ -5,11 +5,13 @@ describe "brew style" do begin FileUtils.ln_s HOMEBREW_LIBRARY_PATH, HOMEBREW_LIBRARY/"Homebrew" FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop.yml", HOMEBREW_LIBRARY/".rubocop_audit.yml" + FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop_shared.yml", HOMEBREW_LIBRARY/".rubocop_shared.yml" example.run ensure FileUtils.rm_f HOMEBREW_LIBRARY/"Homebrew" FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop_audit.yml" + FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop_shared.yml" end end