Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to rubocop 0.76 #163

Merged
merged 18 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions rubocop-airbnb/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require:
- rubocop-performance
- rubocop-rails
inherit_from:
- .rubocop_airbnb.yml
- ./config/default.yml
Expand Down
13 changes: 3 additions & 10 deletions rubocop-airbnb/config/rubocop-layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Layout/FirstMethodParameterLineBreak:
Enabled: false

# Supports --auto-correct
Layout/FirstParameterIndentation:
Layout/IndentFirstArgument:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new name is Layout/FirstArgumentIndentation.

Description: Checks the indentation of the first parameter in a method call.
Enabled: true
EnforcedStyle: consistent
Expand All @@ -238,7 +238,7 @@ Layout/FirstParameterIndentation:
- special_for_inner_method_call_in_parentheses

# Supports --auto-correct
Layout/IndentArray:
Layout/IndentFirstArrayElement:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new name is Layout/FirstArrayElementIndentation.

Description: Checks the indentation of the first element in an array literal.
Enabled: true
EnforcedStyle: consistent
Expand All @@ -248,10 +248,9 @@ Layout/IndentAssignment:
Description: Checks the indentation of the first line of the right-hand-side of a
multi-line assignment.
Enabled: true
IndentationWidth:

# Supports --auto-correct
Layout/IndentHash:
Layout/IndentFirstHashElement:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new name is Layout/FirstHashElementIndentation

Copy link
Collaborator Author

@zachsabin zachsabin Nov 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all of these Indent -> Indentation name changes are in rubocop 0.77, which isn't released yet.

rubocop/rubocop#7468

Description: Checks the indentation of the first key in a hash literal.
Enabled: true
EnforcedStyle: consistent
Expand Down Expand Up @@ -344,7 +343,6 @@ Layout/MultilineMethodCallIndentation:
SupportedStyles:
- aligned
- indented
IndentationWidth:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IndentationWidth isn't supported anymore, although I can't find in the rubocop changelog where exactly that happened.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the cop is Layout/IndentationWidth. This line with bare IndentationWidth should probably never have been here, so you were right to remove it.


Layout/MultilineMethodDefinitionBraceLayout:
Description: >-
Expand Down Expand Up @@ -474,11 +472,6 @@ Layout/SpaceInsideBlockBraces:
EnforcedStyleForEmptyBraces: no_space
SpaceBeforeBlockParameters: true

Layout/SpaceInsideParens:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just duplicated elsewhere in the file! It still exists, but the newer rubocop doesn't allow duplicated styles it seems.

Description: 'No spaces after ( or before ).'
StyleGuide: '#spaces-braces'
Enabled: true

Layout/SpaceInsideArrayLiteralBrackets:
EnforcedStyle: no_space
SupportedStyles:
Expand Down
13 changes: 9 additions & 4 deletions rubocop-airbnb/config/rubocop-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ Lint/EnsureReturn:
Lint/ErbNewArguments:
Enabled: false

Lint/FlipFlop:
Description: Checks for flip flops
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-flip-flops
Enabled: false

Lint/FloatOutOfRange:
Description: Catches floating-point literals too large or small for Ruby to represent.
Enabled: false
Expand Down Expand Up @@ -237,20 +242,20 @@ Lint/UnderscorePrefixedVariableName:
Lint/UnifiedInteger:
Enabled: false

Lint/UnneededCopDisableDirective:
Lint/RedundantCopDisableDirective:
Description: >-
Checks for rubocop:disable comments that can be removed.
Note: this cop is not disabled when disabling all cops. It must be explicitly disabled.
Enabled: true

Lint/UnneededCopEnableDirective:
Lint/RedundantCopEnableDirective:
Description: Checks for rubocop:enable comments that can be removed.
Enabled: true

Lint/UnneededRequireStatement:
Lint/RedundantRequireStatement:
Enabled: false

Lint/UnneededSplatExpansion:
Lint/RedundantSplatExpansion:
Enabled: false

Lint/UnreachableCode:
Expand Down
18 changes: 5 additions & 13 deletions rubocop-airbnb/config/rubocop-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,6 @@ Style/ExpandPathArguments:
Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
Enabled: false

Style/FlipFlop:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to rubocop-airbnb/config/rubocop-lint.yml

Description: Checks for flip flops
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-flip-flops
Enabled: false

Style/For:
Description: Checks use of for or each in multiline loops.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-for-loops
Expand Down Expand Up @@ -360,10 +355,7 @@ Style/FrozenStringLiteralComment:
Description: Add the frozen_string_literal comment to the top of files to help transition
from Ruby 2.3.0 to Ruby 3.0.
Enabled: false
EnforcedStyle: when_needed
SupportedStyles:
- when_needed
- always
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this stay here, but with - never and - always as the choices?

EnforcedStyle: always
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when_needed does not appear to be allowed anymore.

Error: invalid EnforcedStyle 'when_needed' for Style/FrozenStringLiteralComment found in config/rubocop-style.yml
Valid choices are: always, never


Style/GlobalVars:
Description: Do not introduce global variables.
Expand Down Expand Up @@ -922,20 +914,20 @@ Style/UnlessElse:
Enabled: true

# Supports --auto-correct
Style/UnneededCapitalW:
Style/RedundantCapitalW:
Description: Checks for %W when interpolation is not needed.
Enabled: false

Style/UnneededCondition:
Style/RedundantCondition:
Enabled: false

# Supports --auto-correct
Style/UnneededInterpolation:
Style/RedundantInterpolation:
Description: Checks for strings that are just an interpolated expression.
Enabled: false

# Supports --auto-correct
Style/UnneededPercentQ:
Style/RedundantPercentQ:
Description: Checks for %q/%Q when single quotes or double quotes would do.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-q
Enabled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def enforce_violation(node)
alias on_send enforce_violation
alias on_if enforce_violation

Util::ASGN_NODES.each do |type|
RuboCop::AST::Node::ASSIGNMENTS.each do |type|
define_method("on_#{type}") do |node|
enforce_violation(node)
end
Expand Down
4 changes: 3 additions & 1 deletion rubocop-airbnb/rubocop-airbnb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ Gem::Specification.new do |spec|
'Gemfile',
]

spec.add_dependency('rubocop', '~> 0.58.0')
spec.add_dependency('rubocop', '~> 0.76.0')
spec.add_dependency('rubocop-performance', '~> 1.5.0')
spec.add_dependency('rubocop-rails', '~> 2.3.2')
spec.add_dependency('rubocop-rspec', '~> 1.30.0')
spec.add_development_dependency('rspec', '~> 3.5')
end