Skip to content

Commit

Permalink
Update to Rubocop 0.75.1
Browse files Browse the repository at this point in the history
This resolves a large number of warnings and gives us a new cop for
automatically migrating the namespace of the cop disables in comments

* [#7407](rubocop/rubocop#7407): Make `Style/FormatStringToken` work inside hashes. ([@buehmann][])
* [#7389](rubocop/rubocop#7389): Fix an issue where passing a formatter might result in an error depending on what character it started with. ([@jfhinchcliffe][])
* [#7397](rubocop/rubocop#7397): Fix extra comments being added to the correction of `Style/SafeNavigation`. ([@rrosenblum][])
* [#7378](rubocop/rubocop#7378): Fix heredoc edge cases in `Layout/EmptyLineAfterGuardClause`. ([@gsamokovarov][])
* [#7404](rubocop/rubocop#7404): Fix a false negative for `Layout/IndentAssignment` when multiple assignment with line breaks on each line. ([@koic][])
* [#7256](rubocop/rubocop#7256): Fix an error of `Style/RedundantParentheses` on method calls where the first argument begins with a hash literal. ([@halfwhole][])
* [#7263](rubocop/rubocop#7263): Make `Layout/SpaceInsideArrayLiteralBrackets` properly handle tab-indented arrays. ([@buehmann][])
* [#7252](rubocop/rubocop#7252): Prevent infinite loops by making `Layout/SpaceInsideStringInterpolation` skip over interpolations that start or end with a line break. ([@buehmann][])
* [#7262](rubocop/rubocop#7262): `Lint/FormatParameterMismatch` did not recognize named format sequences like `%.2<name>f` where the name appears after some modifiers. ([@buehmann][])
* [#7253](rubocop/rubocop#7253): Fix an error for `Lint/NumberConversion` when `#to_i` called without a receiver. ([@koic][])
* [#7271](rubocop/rubocop#7271), [#6498](rubocop/rubocop#6498): Fix an interference between `Style/TrailingCommaIn*Literal` and `Layout/Multiline*BraceLayout` for arrays and hashes. ([@buehmann][])
* [#7241](rubocop/rubocop#7241): Make `Style/FrozenStringLiteralComment` match only true & false. ([@tejasbubane][])
* [#7290](rubocop/rubocop#7290): Handle inner conditional inside `else` in `Style/ConditionalAssignment`. ([@jonas054][])
* [#5788](rubocop/rubocop#5788): Allow block arguments on separate lines if line would be too long in `Layout/MultilineBlockLayout`. ([@jonas054][])
* [#7305](rubocop/rubocop#7305): Register `Style/BlockDelimiters` offense when block result is assigned to an attribute. ([@mvz][])
* [#4802](rubocop/rubocop#4802): Don't leave any `Lint/UnneededCopEnableDirective` offenses undetected/uncorrected. ([@jonas054][])
* [#7326](rubocop/rubocop#7326): Fix a false positive for `Style/AccessModifierDeclarations` when access modifier name is used for hash literal value. ([@koic][])
* [#3591](rubocop/rubocop#3591): Handle modifier `if`/`unless` correctly in `Lint/UselessAssignment`. ([@jonas054][])
* [#7161](rubocop/rubocop#7161): Fix `Style/SafeNavigation` cop for preserve comments inside if expression. ([@tejasbubane][])
* [#5212](rubocop/rubocop#5212): Avoid false positive for braces that are needed to preserve semantics in `Style/BracesAroundHashParameters`. ([@jonas054][])
* [#7353](rubocop/rubocop#7353): Fix a false positive for `Style/RedundantSelf` when receiver and multiple assigned lvalue have the same name. ([@koic][])
* [#7353](rubocop/rubocop#7353): Fix a false positive for `Style/RedundantSelf` when a self receiver is used as a method argument. ([@koic][])
* [#7358](rubocop/rubocop#7358): Fix an incorrect autocorrect for `Style/NestedModifier` when parentheses are required in method arguments. ([@koic][])
* [#7361](rubocop/rubocop#7361): Fix a false positive for `Style/TernaryParentheses` when only the closing parenthesis is used in the last line of condition. ([@koic][])
* [#7369](rubocop/rubocop#7369): Fix an infinite loop error for `Layout/IndentAssignment` with `Layout/IndentFirstArgument` when using multiple assignment. ([@koic][])
* [#7177](rubocop/rubocop#7177), [#7370](rubocop/rubocop#7370): When correcting alignment, do not insert spaces into string literals. ([@buehmann][])
* [#7367](rubocop/rubocop#7367): Fix an error for `Style/OrAssignment` cop when `then` branch body is empty. ([@koic][])
* [#7363](rubocop/rubocop#7363): Fix an incorrect autocorrect for `Layout/SpaceInsideBlockBraces` and `Style/BlockDelimiters` when using multiline empty braces. ([@koic][])
* [#7212](rubocop/rubocop#7212): Fix a false positive for `Layout/EmptyLinesAroundAccessModifier` and `UselessAccessModifier` when using method with the same name as access modifier around a method definition. ([@koic][])
* [#7217](rubocop/rubocop#7217): Make `Style/TrailingMethodEndStatement` work on more than the first `def`. ([@buehmann][])
* [#7190](rubocop/rubocop#7190): Support lower case drive letters on Windows. ([@jonas054][])
* Fix the auto-correction of `Lint/UnneededSplatExpansion` when the splat expansion of `Array.new` with a block is assigned to a variable. ([@rrosenblum][])
* [#5628](rubocop/rubocop#5628): Fix an error of `Layout/SpaceInsideStringInterpolation` on interpolations with multiple statements. ([@buehmann][])
* [#7128](rubocop/rubocop#7128): Make `Metrics/LineLength` aware of shebang. ([@koic][])
* [#6861](rubocop/rubocop#6861): Fix a false positive for `Layout/IndentationWidth` when using `EnforcedStyle: outdent` of `Layout/AccessModifierIndentation`. ([@koic][])
* [#7235](rubocop/rubocop#7235): Fix an error where `Style/ConditionalAssignment` would swallow a nested `if` condition. ([@buehmann][])
* [#7242](rubocop/rubocop#7242): Make `Style/ConstantVisibility` work on non-trivial class and module bodies. ([@buehmann][])
* [#5265](rubocop/rubocop#5265): Improved `Layout/ExtraSpacing` cop to handle nested consecutive assignments. ([@jfelchner][])
* [#7215](rubocop/rubocop#7215): Make it clear what's wrong in the message from `Style/GuardClause`. ([@jonas054][])
* [#7245](rubocop/rubocop#7245): Make cops detect string interpolations in more contexts: inside of backticks, regular expressions, and symbols. ([@buehmann][])
 [#7275](rubocop/rubocop#7275): Make `Style/VariableName` aware argument names when invoking a method. ([@koic][])
* [#3534](rubocop/rubocop#3534): Make `Style/IfUnlessModifier` report and auto-correct modifier lines that are too long. ([@jonas054][])
* [#7261](rubocop/rubocop#7261): `Style/FrozenStringLiteralComment` no longer inserts an empty line after the comment. This is left to `Layout/EmptyLineAfterMagicComment`. ([@buehmann][])
* [#7091](rubocop/rubocop#7091): `Style/FormatStringToken` now detects format sequences with flags and modifiers. ([@buehmann][])
* [#7319](rubocop/rubocop#7319): Rename `IgnoredMethodPatterns` option to `IgnoredPatterns` option for `Style/MethodCallWithArgsParentheses`. ([@koic][])
* [#7345](rubocop/rubocop#7345): Mark unsafe for `Style/YodaCondition`. ([@koic][])
* [#7170](rubocop/rubocop#7170): Fix a false positive for `Layout/RescueEnsureAlignment` when def line is preceded with `private_class_method`. ([@tatsuyafw][])
* [#7186](rubocop/rubocop#7186): Fix a false positive for `Style/MixinUsage` when using inside multiline block and `if` condition is after `include`. ([@koic][])
* [#7099](rubocop/rubocop#7099): Fix an error of `Layout/RescueEnsureAlignment` on assigned blocks. ([@tatsuyafw][])
* [#5088](rubocop/rubocop#5088): Fix an error of `Layout/MultilineMethodCallIndentation` on method chains inside an argument. ([@buehmann][])
* [#4719](rubocop/rubocop#4719): Make `Layout/Tab` detect tabs between string literals. ([@buehmann][])
* [#7203](rubocop/rubocop#7203): Fix an infinite loop error for `Layout/SpaceInsideBlockBraces` when `EnforcedStyle: no_space` with `SpaceBeforeBlockParameters: false` are set in multiline block. ([@koic][])
* [#6653](rubocop/rubocop#6653): Fix a bug where `Layout/IndentHeredoc` would remove empty lines when autocorrecting heredocs. ([@buehmann][])
* [#7188](rubocop/rubocop#7188): Include inspected file location in auto-correction error. ([@pocke][])

Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed Oct 30, 2019
1 parent 1dccca3 commit 2f38aea
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 6 deletions.
13 changes: 13 additions & 0 deletions config/cookstyle.yml
Expand Up @@ -1288,6 +1288,19 @@ Metrics/CyclomaticComplexity:
Metrics/PerceivedComplexity:
Enabled: false

#### COPS FOR THE NEXT MAJOR RELEASE

# This updates how we send helpers into the Chef recipe/resource classes and makes WAY more sense
# Chef::Recipe.send(:include, ::Apt::Helpers) -> Chef::Recipe.include ::Apt::Helpers
# Lint/SendWithMixinArgument:
# Enabled: true

#### END COPS FOR THE NEXT MAJOR RELEASE

# this migrates old # rubocop: comments to use the latest namespaces, which prevents a ton of spam during cookstyle runs
Migration/DepartmentName:
Enabled: true

# https://github.com/chef/cookstyle/pull/5
Style/TrailingCommaInHashLiteral:
Enabled: true
Expand Down
8 changes: 8 additions & 0 deletions config/disable_all.yml
@@ -1,4 +1,6 @@
---
Migration/DepartmentName:
Enabled: false
Bundler/DuplicatedGem:
Enabled: false
Bundler/GemComment:
Expand Down Expand Up @@ -303,6 +305,8 @@ Lint/SafeNavigationWithEmpty:
Enabled: false
Lint/ScriptPermission:
Enabled: false
Lint/SendWithMixinArgument:
Enabled: false
Lint/ShadowedArgument:
Enabled: false
Lint/ShadowedException:
Expand Down Expand Up @@ -465,6 +469,8 @@ Style/DocumentationMethod:
Enabled: false
Style/Documentation:
Enabled: false
Style/DoubleCopDisableDirective:
Enabled: false
Style/DoubleNegation:
Enabled: false
Style/EachForSimpleLoop:
Expand Down Expand Up @@ -569,6 +575,8 @@ Style/MultilineMemoization:
Enabled: false
Style/MultilineTernaryOperator:
Enabled: false
Style/MultilineWhenThen:
Enabled: false
Style/MultipleComparison:
Enabled: false
Style/MutableConstant:
Expand Down
48 changes: 43 additions & 5 deletions config/upstream.yml
Expand Up @@ -816,6 +816,8 @@ Layout/LeadingCommentSpace:
StyleGuide: '#hash-space'
Enabled: true
VersionAdded: '0.49'
VersionChanged: '0.73'
AllowDoxygenCommentStyle: false

Layout/MultilineArrayBraceLayout:
Description: >-
Expand Down Expand Up @@ -1589,6 +1591,11 @@ Lint/ScriptPermission:
VersionAdded: '0.49'
VersionChanged: '0.50'

Lint/SendWithMixinArgument:
Description: 'Checks for `send` method when using mixin.'
Enabled: true
VersionAdded: '0.75'

Lint/ShadowedArgument:
Description: 'Avoid reassigning arguments before they were used.'
Enabled: true
Expand Down Expand Up @@ -1660,6 +1667,7 @@ Lint/UnneededSplatExpansion:
Description: 'Checks for splat unnecessarily being called on literals.'
Enabled: true
VersionAdded: '0.43'
VersionChanged: '0.74'

Lint/UnreachableCode:
Description: 'Unreachable code.'
Expand Down Expand Up @@ -1743,7 +1751,7 @@ Metrics/AbcSize:
branches, and conditions.
Reference:
- http://c2.com/cgi/wiki?AbcMetric
- https://en.wikipedia.org/wiki/ABC_Software_Metric'
- https://en.wikipedia.org/wiki/ABC_Software_Metric
Enabled: true
VersionAdded: '0.27'
VersionChanged: '0.66'
Expand Down Expand Up @@ -1807,7 +1815,7 @@ Metrics/LineLength:
- https
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
# directives like '# rubocop: enable ...' when calculating a line's length.
IgnoreCopDirectives: false
IgnoreCopDirectives: true
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
# elements. Strings will be converted to Regexp objects. A line that matches
# any regular expression listed in this option will be ignored by LineLength.
Expand Down Expand Up @@ -1846,6 +1854,14 @@ Metrics/PerceivedComplexity:
VersionAdded: '0.25'
Max: 7

################## Migration #############################

Migration/DepartmentName:
Description: >-
Check that cop names in rubocop:disable (etc) comments are
given with department name.
Enabled: false

#################### Naming ##############################

Naming/AccessorMethodName:
Expand Down Expand Up @@ -1981,6 +1997,13 @@ Naming/MethodName:
SupportedStyles:
- snake_case
- camelCase
# Method names matching patterns are always allowed.
#
# IgnoredPatterns:
# - '\A\s*onSelectionBulkChange\s*'
# - '\A\s*onSelectionCleared\s*'
#
IgnoredPatterns: []

Naming/PredicateName:
Description: 'Check the names of predicate methods.'
Expand Down Expand Up @@ -2344,7 +2367,7 @@ Style/ClassAndModuleChildren:
StyleGuide: '#namespace-definition'
# Moving from compact to nested children requires knowledge of whether the
# outer parent is a module or a class. Moving from nested to compact requires
# verification that the outer parent is defined elsewhere. RuboCop does not
# verification that the outer parent is defined elsewhere. Rubocop does not
# have the knowledge to perform either operation safely and thus requires
# manual oversight.
SafeAutoCorrect: false
Expand Down Expand Up @@ -2555,6 +2578,11 @@ Style/DocumentationMethod:
- 'test/**/*'
RequireForNonPublicMethods: false

Style/DoubleCopDisableDirective:
Description: 'Checks for double rubocop:disable comments on a single line.'
Enabled: true
VersionAdded: '0.73'

Style/DoubleNegation:
Description: 'Checks for uses of double negation (!!).'
StyleGuide: '#no-bang-bang'
Expand Down Expand Up @@ -2698,7 +2726,7 @@ Style/FormatStringToken:
- template
- unannotated
VersionAdded: '0.49'
VersionChanged: '0.52'
VersionChanged: '0.75'

Style/FrozenStringLiteralComment:
Description: >-
Expand Down Expand Up @@ -2891,6 +2919,7 @@ Style/MethodCallWithArgsParentheses:
VersionChanged: '0.61'
IgnoreMacros: true
IgnoredMethods: []
IgnoredPatterns: []
IncludedMacros: []
AllowParenthesesInMultilineCall: false
AllowParenthesesInChaining: false
Expand Down Expand Up @@ -3041,6 +3070,12 @@ Style/MultilineTernaryOperator:
Enabled: true
VersionAdded: '0.9'

Style/MultilineWhenThen:
Description: 'Do not use then for multi-line when statement.'
StyleGuide: '#no-then'
Enabled: true
VersionAdded: '0.73'

Style/MultipleComparison:
Description: >-
Avoid comparing a variable with multiple items in a conditional,
Expand Down Expand Up @@ -3572,6 +3607,8 @@ Style/StringHashKeys:
StyleGuide: '#symbols-as-keys'
Enabled: false
VersionAdded: '0.52'
VersionChanged: '0.75'
Safe: false

Style/StringLiterals:
Description: 'Checks if uses of quotes match the configured preference.'
Expand Down Expand Up @@ -3890,8 +3927,9 @@ Style/YodaCondition:
- require_for_all_comparison_operators
# enforce yoda only for equality operators: `!=` and `==`
- require_for_equality_operators_only
Safe: false
VersionAdded: '0.49'
VersionChanged: '0.63'
VersionChanged: '0.75'

Style/ZeroLengthPredicate:
Description: 'Use #empty? when testing for objects of length 0.'
Expand Down
2 changes: 1 addition & 1 deletion lib/cookstyle/version.rb
@@ -1,4 +1,4 @@
module Cookstyle
VERSION = "5.10.14".freeze # rubocop: disable Style/StringLiterals
RUBOCOP_VERSION = '0.72.0'.freeze
RUBOCOP_VERSION = '0.75.1'.freeze
end

0 comments on commit 2f38aea

Please sign in to comment.