From 768ba34b1428782a2df6c6d0b4d49241d257439e Mon Sep 17 00:00:00 2001 From: Martin Afanasjew Date: Tue, 12 Jul 2016 07:49:55 +0200 Subject: 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).--- Library/.rubocop.yml | 20 +++++++++----------- Library/Homebrew/cmd/style.rb | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'Library') diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 74a488917..74aa17b14 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -3,9 +3,13 @@ AllCops: - 'Homebrew/vendor/**/*' - 'Homebrew/test/vendor/**/*' -# 1.8-style hash keys +# Ruby 1.8 compatibility +Style/DotPosition: + EnforcedStyle: trailing Style/HashSyntax: EnforcedStyle: hash_rockets +Style/TrailingCommaInArguments: + EnforcedStyleForMultiline: no_comma # ruby style guide favorite Style/StringLiterals: @@ -23,6 +27,10 @@ Style/CommandLiteral: Style/RegexpLiteral: 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 # requiring users to change that now would be confusing. Style/ConditionalAssignment: @@ -115,10 +123,6 @@ Style/WordArray: Style/UnneededCapitalW: Enabled: false -# we use raise, not fail -Style/SignalException: - EnforcedStyle: only_raise - # we prefer compact if-else-end/case-when-end alignment Lint/EndAlignment: AlignWith: variable @@ -129,12 +133,6 @@ Style/CaseIndentation: Style/PerlBackrefs: Enabled: false -# this is required for Ruby 1.8 -Style/DotPosition: - EnforcedStyle: trailing - # makes diffs nicer -Style/TrailingCommaInArguments: - EnforcedStyleForMultiline: no_comma Style/TrailingCommaInLiteral: EnforcedStyleForMultiline: comma diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index 0e756ad0c..ca28ca712 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -47,7 +47,7 @@ module Homebrew def check_style_impl(files, output_type, options = {}) fix = options[:fix] - Homebrew.install_gem_setup_path! "rubocop", "0.41.1" + Homebrew.install_gem_setup_path! "rubocop", "0.41.2" args = %W[ --force-exclusion -- cgit v1.2.3