Skip to content

Commit

Permalink
update rubocop and enable four new cops, re-enabling two that have be…
Browse files Browse the repository at this point in the history
…en fixed

* Update Rubocop from
  [0.90](https://github.com/rubocop-hq/rubocop/releases/tag/v0.90.0)
  to
  [0.91](https://github.com/rubocop-hq/rubocop/releases/tag/v0.91.0),
  enabling:
  * [`Lint/UselessTimes`](rubocop/rubocop#8702)
  * [`Layout/BeginEndAlignment`](rubocop/rubocop#8628)
  * [`Lint/ConstantDefinitionInBlock`](rubocop/rubocop#8707)
  * [`Lint/IdentityComparison`](rubocop/rubocop#8699)
  re-enabling after bug fixes:
  * [`Bundler/DuplicatedGem`](rubocop/rubocop#8666)
  * [`Naming/BinaryOperatorParameterName`](rubocop/rubocop#8664)
  • Loading branch information
Jennifer Konikowski committed Sep 16, 2020
1 parent c821c12 commit cb1a2de
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 14 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,20 @@
# Changelog

## unreleased

* Update Rubocop from
[0.90](https://github.com/rubocop-hq/rubocop/releases/tag/v0.90.0)
to
[0.91](https://github.com/rubocop-hq/rubocop/releases/tag/v0.91.0),
enabling:
* [`Lint/UselessTimes`](https://github.com/rubocop-hq/rubocop/pull/8702)
* [`Layout/BeginEndAlignment`](https://github.com/rubocop-hq/rubocop/pull/8628)
* [`Lint/ConstantDefinitionInBlock`](https://github.com/rubocop-hq/rubocop/pull/8707)
* [`Lint/IdentityComparison`](https://github.com/rubocop-hq/rubocop/pull/8699/)
re-enabling after bug fixes:
* [`Bundler/DuplicatedGem`](https://github.com/rubocop-hq/rubocop/pull/8666)
* [`Naming/BinaryOperatorParameterName`](https://github.com/rubocop-hq/rubocop/issues/8664)

## 0.6.0

* Update Rubocop from
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Expand Up @@ -24,16 +24,16 @@ GEM
rake (13.0.1)
regexp_parser (1.7.1)
rexml (3.2.4)
rubocop (0.90.0)
rubocop (0.91.0)
parallel (~> 1.10)
parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.3.0, < 1.0)
rubocop-ast (>= 0.4.0, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.3.0)
rubocop-ast (0.4.0)
parser (>= 2.7.1.4)
rubocop-performance (1.8.0)
rubocop (>= 0.87.0)
Expand Down
47 changes: 36 additions & 11 deletions config/base.yml
Expand Up @@ -7,6 +7,13 @@ AllCops:
DisabledByDefault: true
Exclude: []

Bundler/DuplicatedGem:
Enabled: true
Include:
- '**/*.gemfile'
- '**/Gemfile'
- '**/gems.rb'

Bundler/InsecureProtocolSource:
Enabled: true
Include:
Expand All @@ -32,16 +39,15 @@ Layout/ArrayAlignment:
Enabled: true
EnforcedStyle: with_fixed_indentation

Layout/HashAlignment:
Layout/AssignmentIndentation:
Enabled: true
EnforcedHashRocketStyle: key
EnforcedColonStyle: key
EnforcedLastArgumentHashStyle: always_inspect
IndentationWidth: ~

Layout/ParameterAlignment:
Layout/BeginEndAlignment:
Enabled: true
EnforcedStyle: with_fixed_indentation
IndentationWidth: ~
EnforcedStyleAlignWith: start_of_line
AutoCorrect: true
Severity: warning

Layout/BlockAlignment:
Enabled: true
Expand Down Expand Up @@ -149,15 +155,17 @@ Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
IndentationWidth: ~

Layout/AssignmentIndentation:
Enabled: true
IndentationWidth: ~

Layout/FirstHashElementIndentation:
Enabled: true
EnforcedStyle: consistent
IndentationWidth: ~

Layout/HashAlignment:
Enabled: true
EnforcedHashRocketStyle: key
EnforcedColonStyle: key
EnforcedLastArgumentHashStyle: always_inspect

Layout/HeredocIndentation:
Enabled: true

Expand Down Expand Up @@ -208,6 +216,11 @@ Layout/MultilineOperationIndentation:
EnforcedStyle: indented
IndentationWidth: ~

Layout/ParameterAlignment:
Enabled: true
EnforcedStyle: with_fixed_indentation
IndentationWidth: ~

Layout/RescueEnsureAlignment:
Enabled: true

Expand Down Expand Up @@ -335,6 +348,9 @@ Lint/BooleanSymbol:
Lint/CircularArgumentReference:
Enabled: true

Lint/ConstantDefinitionInBlock:
Enabled: true

Lint/Debugger:
Enabled: true

Expand Down Expand Up @@ -400,6 +416,9 @@ Lint/FloatOutOfRange:
Lint/FormatParameterMismatch:
Enabled: true

Lint/IdentityComparison:
Enabled: true

Lint/ImplicitStringConcatenation:
Enabled: true

Expand Down Expand Up @@ -562,13 +581,19 @@ Lint/UselessElseWithoutRescue:
Lint/UselessSetterCall:
Enabled: true

Lint/UselessTimes:
Enabled: true

Lint/Void:
Enabled: true
CheckForMethodsWithNoSideEffects: false

Migration/DepartmentName:
Enabled: true

Naming/BinaryOperatorParameterName:
Enabled: true

Naming/ClassAndModuleCamelCase:
Enabled: true

Expand Down
15 changes: 15 additions & 0 deletions test/fixture/cli/autocorrectable-bad.rb
Expand Up @@ -39,13 +39,28 @@ def do_stuff( a,b,c )
end
}

test = 'hi'
test2 = 'hi'
test3 = test.object_id == test2.object_id
if test3
32 + 3
end
THINGS.keys.each { |key|
if ( plus_stuff.reduce(:+) > 1 )
THINGS[key] = plus_stuff[i]
end
}
end

def do_even_more_stuff
foo = begin
do_stuff(1,2,3)
rescue StandardError
nil
end
foo
end

end


Expand Down
12 changes: 12 additions & 0 deletions test/fixture/cli/autocorrectable-good.rb
Expand Up @@ -35,12 +35,24 @@ def do_stuff(a, b, c)
end
end

test = "hi"
test2 = "hi"
test3 = test.equal?(test2)
if test3
32 + 3
end
THINGS.keys.each do |key|
if plus_stuff.reduce(:+) > 1
THINGS[key] = plus_stuff[i]
end
end
end

def do_even_more_stuff
do_stuff(1, 2, 3)
rescue
nil
end
end

# some alignment opinions
Expand Down

0 comments on commit cb1a2de

Please sign in to comment.