style: use RuboCop 0.41.2, adjust defaults (#489)

Changes to our style configuration:

- Consolidate all rules related to Ruby 1.8 compatibility in one place.
- Codify our de-facto preference for `alias_method` over `alias` (drops
  offense count by 54 after turning this on).
- Drop `Style/SignalException` as `only_raise` has been the new default
  for quite a while (since RuboCop 0.37.0).
This commit is contained in:
Martin Afanasjew 2016-07-12 07:49:55 +02:00 committed by GitHub
parent 842862c653
commit 768ba34b14
2 changed files with 10 additions and 12 deletions

View File

@ -3,9 +3,13 @@ AllCops:
- 'Homebrew/vendor/**/*' - 'Homebrew/vendor/**/*'
- 'Homebrew/test/vendor/**/*' - 'Homebrew/test/vendor/**/*'
# 1.8-style hash keys # Ruby 1.8 compatibility
Style/DotPosition:
EnforcedStyle: trailing
Style/HashSyntax: Style/HashSyntax:
EnforcedStyle: hash_rockets EnforcedStyle: hash_rockets
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: no_comma
# ruby style guide favorite # ruby style guide favorite
Style/StringLiterals: Style/StringLiterals:
@ -23,6 +27,10 @@ Style/CommandLiteral:
Style/RegexpLiteral: Style/RegexpLiteral:
EnforcedStyle: slashes EnforcedStyle: slashes
# too prevalent to change this now, but might be discussed/changed later
Style/Alias:
EnforcedStyle: prefer_alias_method
# our current conditional style is established, clear and # our current conditional style is established, clear and
# requiring users to change that now would be confusing. # requiring users to change that now would be confusing.
Style/ConditionalAssignment: Style/ConditionalAssignment:
@ -115,10 +123,6 @@ Style/WordArray:
Style/UnneededCapitalW: Style/UnneededCapitalW:
Enabled: false Enabled: false
# we use raise, not fail
Style/SignalException:
EnforcedStyle: only_raise
# we prefer compact if-else-end/case-when-end alignment # we prefer compact if-else-end/case-when-end alignment
Lint/EndAlignment: Lint/EndAlignment:
AlignWith: variable AlignWith: variable
@ -129,12 +133,6 @@ Style/CaseIndentation:
Style/PerlBackrefs: Style/PerlBackrefs:
Enabled: false Enabled: false
# this is required for Ruby 1.8
Style/DotPosition:
EnforcedStyle: trailing
# makes diffs nicer # makes diffs nicer
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: no_comma
Style/TrailingCommaInLiteral: Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: comma EnforcedStyleForMultiline: comma

View File

@ -47,7 +47,7 @@ module Homebrew
def check_style_impl(files, output_type, options = {}) def check_style_impl(files, output_type, options = {})
fix = options[:fix] fix = options[:fix]
Homebrew.install_gem_setup_path! "rubocop", "0.41.1" Homebrew.install_gem_setup_path! "rubocop", "0.41.2"
args = %W[ args = %W[
--force-exclusion --force-exclusion