Deduplicate RuboCop config.
This commit is contained in:
parent
23da62471b
commit
f858a17e96
@ -32,21 +32,11 @@ Layout/CaseIndentation:
|
|||||||
# this is a bit less "floaty"
|
# this is a bit less "floaty"
|
||||||
Layout/EndAlignment:
|
Layout/EndAlignment:
|
||||||
EnforcedStyleAlignWith: start_of_line
|
EnforcedStyleAlignWith: start_of_line
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
|
|
||||||
# enforce use of <<~EOS
|
|
||||||
Layout/IndentHeredoc:
|
|
||||||
EnforcedStyle: squiggly
|
|
||||||
|
|
||||||
# conflicts with DSL-style path concatenation with `/`
|
# conflicts with DSL-style path concatenation with `/`
|
||||||
Layout/SpaceAroundOperators:
|
Layout/SpaceAroundOperators:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# use spaces for indentation; detect tabs
|
|
||||||
Layout/Tab:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6300).
|
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6300).
|
||||||
Layout/EmptyLineAfterGuardClause:
|
Layout/EmptyLineAfterGuardClause:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
@ -81,8 +71,6 @@ Lint/ParenthesesAsGroupedExpression:
|
|||||||
# most metrics don't make sense to apply for formulae/taps
|
# most metrics don't make sense to apply for formulae/taps
|
||||||
Metrics/AbcSize:
|
Metrics/AbcSize:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
Metrics/BlockLength:
|
|
||||||
Enabled: false
|
|
||||||
Metrics/ClassLength:
|
Metrics/ClassLength:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
Metrics/CyclomaticComplexity:
|
Metrics/CyclomaticComplexity:
|
||||||
@ -94,52 +82,11 @@ Metrics/MethodLength:
|
|||||||
Metrics/PerceivedComplexity:
|
Metrics/PerceivedComplexity:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# keyword arguments don't have the same readability problems
|
|
||||||
Metrics/ParameterLists:
|
|
||||||
CountKeywordArgs: false
|
|
||||||
|
|
||||||
# GitHub diff UI wraps beyond 118 characters (so that's the goal)
|
# GitHub diff UI wraps beyond 118 characters (so that's the goal)
|
||||||
Metrics/LineLength:
|
Metrics/LineLength:
|
||||||
Max: 170
|
Max: 170
|
||||||
# ignore manpage comments and long single-line strings
|
# ignore manpage comments and long single-line strings
|
||||||
IgnoredPatterns: ['#: ', ' url "', ' mirror "', ' plist_options :']
|
IgnoredPatterns: ['#: ', ' url "', ' mirror "', ' plist_options :']
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
|
|
||||||
# dashes in filenames are typical
|
|
||||||
Naming/FileName:
|
|
||||||
Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
|
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
|
|
||||||
# implicitly allow EOS as we use it everywhere
|
|
||||||
Naming/HeredocDelimiterNaming:
|
|
||||||
Blacklist:
|
|
||||||
- END, EOD, EOF
|
|
||||||
|
|
||||||
# we have too many variables like sha256 where this harms readability
|
|
||||||
Naming/VariableNumber:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# makes code less readable for minor performance increases
|
|
||||||
Performance/Caller:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# we're doing this already so why not
|
|
||||||
Performance/CaseWhenSplat:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# enable to avoid leaking resources
|
|
||||||
Style/AutoResourceCleanup:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# this is a little more obvious what's going on
|
|
||||||
Style/BarePercentLiterals:
|
|
||||||
EnforcedStyle: percent_q
|
|
||||||
|
|
||||||
# consistency helps readability and helps people who don't know Ruby
|
|
||||||
Style/CollectionMethods:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# our current conditional style is established
|
# our current conditional style is established
|
||||||
# TODO: enable this when possible
|
# TODO: enable this when possible
|
||||||
@ -150,14 +97,6 @@ Style/ConditionalAssignment:
|
|||||||
Style/Documentation:
|
Style/Documentation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# we don't need UTF-8 encoding comments
|
|
||||||
Style/Encoding:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# falsely flags e.g. curl formatting arguments as format strings
|
|
||||||
Style/FormatStringToken:
|
|
||||||
EnforcedStyle: template
|
|
||||||
|
|
||||||
# we want to add this slowly and manually
|
# we want to add this slowly and manually
|
||||||
# TODO: add to more files
|
# TODO: add to more files
|
||||||
Style/FrozenStringLiteralComment:
|
Style/FrozenStringLiteralComment:
|
||||||
@ -170,106 +109,23 @@ Style/GuardClause:
|
|||||||
# depends_on a: :b looks weird in formulae.
|
# depends_on a: :b looks weird in formulae.
|
||||||
Style/HashSyntax:
|
Style/HashSyntax:
|
||||||
EnforcedStyle: hash_rockets
|
EnforcedStyle: hash_rockets
|
||||||
Exclude:
|
|
||||||
- '**/bin/**/*'
|
|
||||||
- '**/cmd/**/*'
|
|
||||||
- '**/lib/**/*'
|
|
||||||
- '**/spec/**/*'
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
|
|
||||||
# this doesn't make sense for wide lines below maximum line length
|
|
||||||
# https://github.com/rubocop-hq/rubocop/issues/6149
|
|
||||||
Style/IfUnlessModifier:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# only for numbers >= 1_000_000
|
|
||||||
Style/NumericLiterals:
|
|
||||||
MinDigits: 7
|
|
||||||
|
|
||||||
# zero-prefixed octal literals are just too widely used (and understood)
|
|
||||||
Style/NumericLiteralPrefix:
|
|
||||||
EnforcedOctalStyle: zero_only
|
|
||||||
|
|
||||||
# rescuing StandardError is an understood default
|
|
||||||
Style/RescueStandardError:
|
|
||||||
EnforcedStyle: implicit
|
|
||||||
|
|
||||||
# return nil is unnecessary and a common mistake believing it's required
|
|
||||||
Style/ReturnNil:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# We have no use for using `warn` because we are
|
|
||||||
# calling Ruby with warnings disabled ourselves (for now).
|
|
||||||
Style/StderrPuts:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# ruby style guide favorite
|
# ruby style guide favorite
|
||||||
Style/StringLiterals:
|
Style/StringLiterals:
|
||||||
EnforcedStyle: double_quotes
|
EnforcedStyle: double_quotes
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
|
|
||||||
# consistency with above
|
# consistency with above
|
||||||
Style/StringLiteralsInInterpolation:
|
Style/StringLiteralsInInterpolation:
|
||||||
EnforcedStyle: double_quotes
|
EnforcedStyle: double_quotes
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
|
|
||||||
# consistency helps readability and helps people who don't know Ruby
|
|
||||||
Style/StringMethods:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# less confusing to non-Rubyists
|
|
||||||
Style/SymbolArray:
|
|
||||||
EnforcedStyle: brackets
|
|
||||||
|
|
||||||
# make things a bit easier to read
|
# make things a bit easier to read
|
||||||
Style/TernaryParentheses:
|
Style/TernaryParentheses:
|
||||||
EnforcedStyle: require_parentheses_when_complex
|
EnforcedStyle: require_parentheses_when_complex
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
|
|
||||||
# messes with existing plist/caveats style
|
# messes with existing plist/caveats style
|
||||||
Style/TrailingBodyOnMethodDefinition:
|
Style/TrailingBodyOnMethodDefinition:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# all trailing commas make diffs nicer
|
|
||||||
Style/TrailingCommaInArguments:
|
|
||||||
EnforcedStyleForMultiline: comma
|
|
||||||
Style/TrailingCommaInArrayLiteral:
|
|
||||||
EnforcedStyleForMultiline: comma
|
|
||||||
Style/TrailingCommaInHashLiteral:
|
|
||||||
EnforcedStyleForMultiline: comma
|
|
||||||
|
|
||||||
# a bit confusing to non-Rubyists but useful for longer arrays
|
# a bit confusing to non-Rubyists but useful for longer arrays
|
||||||
Style/WordArray:
|
Style/WordArray:
|
||||||
MinSize: 4
|
MinSize: 4
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
|
|
||||||
# exclude some styles for casks (for now)
|
|
||||||
# TODO: make Homebrew/brew, casks and formulae more consistent
|
|
||||||
Layout/ElseAlignment:
|
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
Layout/IndentArray:
|
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
Layout/IndentHash:
|
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
Layout/IndentationWidth:
|
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
Performance/StringReplacement:
|
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
Style/EmptyElse:
|
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
Style/PercentLiteralDelimiters:
|
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
Style/RegexpLiteral:
|
|
||||||
Exclude:
|
|
||||||
- '**/Casks/**/*'
|
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
inherit_from: ./.rubocop_shared.yml
|
inherit_from: ./.rubocop_shared.yml
|
||||||
|
|
||||||
# Cask Cops
|
|
||||||
|
|
||||||
Cask/HomepageMatchesUrl:
|
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'
|
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
|
Enabled: true
|
||||||
@ -22,8 +20,6 @@ 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'
|
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
|
Enabled: true
|
||||||
|
|
||||||
# Built-In Cops
|
|
||||||
|
|
||||||
Layout/AlignHash:
|
Layout/AlignHash:
|
||||||
EnforcedHashRocketStyle: table
|
EnforcedHashRocketStyle: table
|
||||||
EnforcedColonStyle: table
|
EnforcedColonStyle: table
|
||||||
@ -34,63 +30,34 @@ Layout/IndentArray:
|
|||||||
Layout/IndentHash:
|
Layout/IndentHash:
|
||||||
EnforcedStyle: align_braces
|
EnforcedStyle: align_braces
|
||||||
|
|
||||||
Metrics/BlockLength:
|
# Casks often contain long URLs and file paths.
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Metrics/LineLength:
|
Metrics/LineLength:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Naming/FileName:
|
# Casks don't need documentation.
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Naming/HeredocDelimiterNaming:
|
|
||||||
Blacklist:
|
|
||||||
- END, EOD, EOF
|
|
||||||
|
|
||||||
Performance/StringReplacement:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/BarePercentLiterals:
|
|
||||||
EnforcedStyle: percent_q
|
|
||||||
|
|
||||||
Style/Documentation:
|
Style/Documentation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/EmptyElse:
|
# These would only be distracting in casks.
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/FrozenStringLiteralComment:
|
Style/FrozenStringLiteralComment:
|
||||||
Enabled: false
|
EnforcedStyle: never
|
||||||
|
|
||||||
|
# Don't use hash rockets.
|
||||||
Style/HashSyntax:
|
Style/HashSyntax:
|
||||||
EnforcedStyle: ruby19_no_mixed_keys
|
EnforcedStyle: ruby19_no_mixed_keys
|
||||||
|
|
||||||
Style/IfUnlessModifier:
|
# This is more readable when the regex contains slashes.
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/PercentLiteralDelimiters:
|
|
||||||
PreferredDelimiters:
|
|
||||||
'%': '{}'
|
|
||||||
'%i': '{}'
|
|
||||||
'%q': '{}'
|
|
||||||
'%Q': '{}'
|
|
||||||
'%r': '{}'
|
|
||||||
'%s': '()'
|
|
||||||
'%w': '[]'
|
|
||||||
'%W': '[]'
|
|
||||||
'%x': '()'
|
|
||||||
|
|
||||||
Style/RegexpLiteral:
|
Style/RegexpLiteral:
|
||||||
EnforcedStyle: percent_r
|
EnforcedStyle: percent_r
|
||||||
|
|
||||||
Style/SymbolArray:
|
# Use consistent style for all arrays.
|
||||||
EnforcedStyle: brackets
|
|
||||||
|
|
||||||
Style/TrailingCommaInArrayLiteral:
|
|
||||||
EnforcedStyleForMultiline: comma
|
|
||||||
|
|
||||||
Style/TrailingCommaInHashLiteral:
|
|
||||||
EnforcedStyleForMultiline: comma
|
|
||||||
|
|
||||||
Style/WordArray:
|
Style/WordArray:
|
||||||
EnforcedStyle: brackets
|
EnforcedStyle: brackets
|
||||||
|
|
||||||
|
# This makes multi-line arrays more readable and alignable.
|
||||||
|
Layout/FirstArrayElementLineBreak:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# This makes multi-line hashes more readable and alignable.
|
||||||
|
Layout/FirstHashElementLineBreak:
|
||||||
|
Enabled: true
|
||||||
|
|||||||
@ -1,7 +1,100 @@
|
|||||||
|
require: ./Homebrew/rubocops.rb
|
||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
TargetRubyVersion: 2.3
|
TargetRubyVersion: 2.3
|
||||||
Exclude:
|
|
||||||
- '**/vendor/**/*'
|
|
||||||
DisplayCopNames: false
|
DisplayCopNames: false
|
||||||
|
|
||||||
require: ./Homebrew/rubocops.rb
|
# Use `<<~` for heredocs.
|
||||||
|
Layout/IndentHeredoc:
|
||||||
|
EnforcedStyle: squiggly
|
||||||
|
|
||||||
|
# Not useful in casks and formulae.
|
||||||
|
Metrics/BlockLength:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Keyword arguments don't have the same readability
|
||||||
|
# problems as normal parameters.
|
||||||
|
Metrics/ParameterLists:
|
||||||
|
CountKeywordArgs: false
|
||||||
|
|
||||||
|
# Implicitly allow EOS as we use it everywhere.
|
||||||
|
Naming/HeredocDelimiterNaming:
|
||||||
|
Blacklist:
|
||||||
|
- END, EOD, EOF
|
||||||
|
|
||||||
|
# Allow dashes in filenames.
|
||||||
|
Naming/FileName:
|
||||||
|
Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
|
||||||
|
|
||||||
|
# Both styles are used depending on context,
|
||||||
|
# e.g. `sha256` and `something_countable_1`.
|
||||||
|
Naming/VariableNumber:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Avoid leaking resources.
|
||||||
|
Style/AutoResourceCleanup:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# This makes these a little more obvious.
|
||||||
|
Style/BarePercentLiterals:
|
||||||
|
EnforcedStyle: percent_q
|
||||||
|
|
||||||
|
# Use consistent style for better readability.
|
||||||
|
Style/CollectionMethods:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# Prefer simple tokens without type annotations.
|
||||||
|
Style/FormatStringToken:
|
||||||
|
EnforcedStyle: template
|
||||||
|
|
||||||
|
# This often leads to lines longer than the maximum line length.
|
||||||
|
# https://github.com/rubocop-hq/rubocop/issues/6149
|
||||||
|
Style/IfUnlessModifier:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Only use this for numbers >= `1_000_000`.
|
||||||
|
Style/NumericLiterals:
|
||||||
|
MinDigits: 7
|
||||||
|
Strict: true
|
||||||
|
|
||||||
|
# Zero-prefixed octal literals are widely used and understood.
|
||||||
|
Style/NumericLiteralPrefix:
|
||||||
|
EnforcedOctalStyle: zero_only
|
||||||
|
|
||||||
|
# Rescuing `StandardError` is an understood default.
|
||||||
|
Style/RescueStandardError:
|
||||||
|
EnforcedStyle: implicit
|
||||||
|
|
||||||
|
# Returning `nil` is unnecessary.
|
||||||
|
Style/ReturnNil:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# We have no use for using `warn` because we
|
||||||
|
# are calling Ruby with warnings disabled.
|
||||||
|
Style/StderrPuts:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Use consistent method names.
|
||||||
|
Style/StringMethods:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# An array of symbols is more readable than a symbol array
|
||||||
|
# and also allows for easier grepping.
|
||||||
|
Style/SymbolArray:
|
||||||
|
EnforcedStyle: brackets
|
||||||
|
|
||||||
|
# Trailing commas make diffs nicer.
|
||||||
|
Style/TrailingCommaInArguments:
|
||||||
|
EnforcedStyleForMultiline: comma
|
||||||
|
Style/TrailingCommaInArrayLiteral:
|
||||||
|
EnforcedStyleForMultiline: comma
|
||||||
|
Style/TrailingCommaInHashLiteral:
|
||||||
|
EnforcedStyleForMultiline: comma
|
||||||
|
|
||||||
|
# Does not hinder readability, so might as well enable it.
|
||||||
|
Performance/CaseWhenSplat:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# Makes code less readable for minor performance increases.
|
||||||
|
Performance/Caller:
|
||||||
|
Enabled: false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user