Merge pull request #5312 from reitermarkus/rubocop

Fix RuboCop for Casks.
This commit is contained in:
Markus Reiter 2018-11-12 05:33:12 +01:00 committed by GitHub
commit 23da62471b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 110 additions and 17 deletions

View File

@ -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

View File

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

96
Library/.rubocop_cask.yml Normal file
View File

@ -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

View File

@ -0,0 +1,7 @@
AllCops:
TargetRubyVersion: 2.3
Exclude:
- '**/vendor/**/*'
DisplayCopNames: false
require: ./Homebrew/rubocops.rb

View File

@ -1,5 +1,4 @@
inherit_from:
- ../.rubocop.yml
inherit_from: ../.rubocop.yml
AllCops:
Include:

View File

@ -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

View File

@ -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