config/default.yml in silvercop-1.0.1 vs config/default.yml in silvercop-1.0.2
- old
+ new
@@ -1,10 +1,10 @@
-# Common configuration.
# This file was copied directly from https://github.com/rubocop-hq/rubocop/blob/v0.68.1/config/default.yml
# That means it has more configuration than it needs, but it's easier to copy and paste into new versions
# since we're just adopting everything in the new version.
+# Common configuration.
AllCops:
RubyInterpreters:
- ruby
- macruby
- rake
@@ -74,11 +74,11 @@
# behavior by overriding `DisplayStyleGuide`, or by giving the
# `-S/--display-style-guide` option.
DisplayStyleGuide: false
# When specifying style guide URLs, any paths and/or fragments will be
# evaluated relative to the base URL.
- StyleGuideBaseURL: https://github.com/rubocop-hq/ruby-style-guide
+ StyleGuideBaseURL: https://rubystyle.guide
# Extra details are not displayed in offense messages by default. Change
# behavior by overriding ExtraDetails, or by giving the
# `-E/--extra-details` option.
ExtraDetails: false
# Additional cops that do not reference a style guide rule may be enabled by
@@ -124,20 +124,12 @@
# .ruby-version file, Gemfile or gems.rb file, RuboCop will try to determine
# the desired version of Ruby by inspecting the .ruby-version file first,
# followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
# is specified in the Gemfile or gems.rb file, RuboCop reads the final value
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
- # use the oldest officially supported Ruby version (currently Ruby 2.2).
+ # use the oldest officially supported Ruby version (currently Ruby 2.3).
TargetRubyVersion: ~
- # What version of Rails is the inspected code using? If a value is specified
- # for TargetRailsVersion then it is used. Acceptable values are specificed
- # as a float (i.e. 5.1); the patch version of Rails should not be included.
- # If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
- # gems.locked file to find the version of Rails that has been bound to the
- # application. If neither of those files exist, RuboCop will use Rails 5.0
- # as the default.
- TargetRailsVersion: ~
#################### Bundler ###############################
Bundler/DuplicatedGem:
Description: 'Checks for duplicate gem entries in Gemfile.'
@@ -150,15 +142,16 @@
Bundler/GemComment:
Description: 'Add a comment describing each gem.'
Enabled: false
VersionAdded: '0.59'
+ VersionChanged: '0.77'
Include:
- '**/*.gemfile'
- '**/Gemfile'
- '**/gems.rb'
- Whitelist: []
+ IgnoredGems: []
Bundler/InsecureProtocolSource:
Description: >-
The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
because HTTP requests are insecure. Please change your source to
@@ -204,10 +197,17 @@
Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
Enabled: true
VersionAdded: '0.52'
Include:
- '**/*.gemspec'
+ -
+Gemspec/RubyVersionGlobalsUsage:
+ Description: Checks usage of RUBY_VERSION in gemspec.
+ Enabled: true
+ VersionAdded: '0.72'
+ Include:
+ - '**/*.gemspec'
#################### Layout ###########################
Layout/AccessModifierIndentation:
Description: Check indentation of private/protected visibility modifiers.
@@ -220,17 +220,18 @@
- indent
# By default, the indentation width from Layout/IndentationWidth is used
# But it can be overridden by setting this parameter
IndentationWidth: ~
-Layout/AlignArguments:
+Layout/ArgumentAlignment:
Description: >-
Align the arguments of a method call if they span more
than one line.
StyleGuide: '#no-double-indent'
Enabled: true
VersionAdded: '0.68'
+ VersionChanged: '0.77'
# Alignment of arguments in multi-line method calls.
#
# The `with_first_argument` style aligns the following lines along the same
# column as the first parameter.
#
@@ -248,120 +249,27 @@
- with_fixed_indentation
# By default, the indentation width from Layout/IndentationWidth is used
# But it can be overridden by setting this parameter
IndentationWidth: ~
-Layout/AlignArray:
+Layout/ArrayAlignment:
Description: >-
Align the elements of an array literal if they span more than
one line.
StyleGuide: '#align-multiline-arrays'
Enabled: true
VersionAdded: '0.49'
+ VersionChanged: '0.77'
-Layout/AlignHash:
+Layout/AssignmentIndentation:
Description: >-
- Align the elements of a hash literal if they span more than
- one line.
+ Checks the indentation of the first line of the
+ right-hand-side of a multi-line assignment.
Enabled: true
VersionAdded: '0.49'
- # Alignment of entries using hash rocket as separator. Valid values are:
- #
- # key - left alignment of keys
- # 'a' => 2
- # 'bb' => 3
- # separator - alignment of hash rockets, keys are right aligned
- # 'a' => 2
- # 'bb' => 3
- # table - left alignment of keys, hash rockets, and values
- # 'a' => 2
- # 'bb' => 3
- EnforcedHashRocketStyle: key
- SupportedHashRocketStyles:
- - key
- - separator
- - table
- # Alignment of entries using colon as separator. Valid values are:
- #
- # key - left alignment of keys
- # a: 0
- # bb: 1
- # separator - alignment of colons, keys are right aligned
- # a: 0
- # bb: 1
- # table - left alignment of keys and values
- # a: 0
- # bb: 1
- EnforcedColonStyle: key
- SupportedColonStyles:
- - key
- - separator
- - table
- # Select whether hashes that are the last argument in a method call should be
- # inspected? Valid values are:
- #
- # always_inspect - Inspect both implicit and explicit hashes.
- # Registers an offense for:
- # function(a: 1,
- # b: 2)
- # Registers an offense for:
- # function({a: 1,
- # b: 2})
- # always_ignore - Ignore both implicit and explicit hashes.
- # Accepts:
- # function(a: 1,
- # b: 2)
- # Accepts:
- # function({a: 1,
- # b: 2})
- # ignore_implicit - Ignore only implicit hashes.
- # Accepts:
- # function(a: 1,
- # b: 2)
- # Registers an offense for:
- # function({a: 1,
- # b: 2})
- # ignore_explicit - Ignore only explicit hashes.
- # Accepts:
- # function({a: 1,
- # b: 2})
- # Registers an offense for:
- # function(a: 1,
- # b: 2)
- EnforcedLastArgumentHashStyle: always_inspect
- SupportedLastArgumentHashStyles:
- - always_inspect
- - always_ignore
- - ignore_implicit
- - ignore_explicit
-
-Layout/AlignParameters:
- Description: >-
- Align the parameters of a method definition if they span more
- than one line.
- StyleGuide: '#no-double-indent'
- Enabled: true
- VersionAdded: '0.49'
- VersionChanged: '0.68'
- # Alignment of parameters in multi-line method calls.
- #
- # The `with_first_parameter` style aligns the following lines along the same
- # column as the first parameter.
- #
- # def method_foo(a,
- # b)
- #
- # The `with_fixed_indentation` style aligns the following lines with one
- # level of indentation relative to the start of the line with the method call.
- #
- # def method_foo(a,
- # b)
- EnforcedStyle: with_first_parameter
- SupportedStyles:
- - with_first_parameter
- - with_fixed_indentation
- # By default, the indentation width from Layout/IndentationWidth is used
+ VersionChanged: '0.77'
+ # By default, the indentation width from `Layout/IndentationWidth` is used
# But it can be overridden by setting this parameter
IndentationWidth: ~
Layout/BlockAlignment:
Description: 'Align block ends correctly.'
@@ -509,10 +417,17 @@
Layout/EmptyLinesAroundAccessModifier:
Description: "Keep blank lines around access modifiers."
StyleGuide: '#empty-lines-around-access-modifier'
Enabled: true
VersionAdded: '0.49'
+ EnforcedStyle: around
+ SupportedStyles:
+ - around
+ - only_before
+ Reference:
+ # A reference to `EnforcedStyle: only_before`.
+ - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
Layout/EmptyLinesAroundArguments:
Description: "Keeps track of empty lines around method arguments."
Enabled: true
VersionAdded: '0.52'
@@ -618,60 +533,15 @@
# If done for alignment, either this OR AllowForAlignment will allow it.
AllowBeforeTrailingComments: false
# When true, forces the alignment of `=` in assignments on consecutive lines.
ForceEqualSignAlignment: false
-Layout/FirstArrayElementLineBreak:
- Description: >-
- Checks for a line break before the first element in a
- multi-line array.
- Enabled: false
- VersionAdded: '0.49'
-
-Layout/FirstHashElementLineBreak:
- Description: >-
- Checks for a line break before the first element in a
- multi-line hash.
- Enabled: false
- VersionAdded: '0.49'
-
-Layout/FirstMethodArgumentLineBreak:
- Description: >-
- Checks for a line break before the first argument in a
- multi-line method call.
- Enabled: false
- VersionAdded: '0.49'
-
-Layout/FirstMethodParameterLineBreak:
- Description: >-
- Checks for a line break before the first parameter in a
- multi-line method parameter definition.
- Enabled: false
- VersionAdded: '0.49'
-
-Layout/HeredocArgumentClosingParenthesis:
- Description: >-
- Checks for the placement of the closing parenthesis in a
- method call that passes a HEREDOC string as an argument.
- Enabled: false
- StyleGuide: '#heredoc-argument-closing-parentheses'
- VersionAdded: '0.68'
-
-Layout/IndentAssignment:
- Description: >-
- Checks the indentation of the first line of the
- right-hand-side of a multi-line assignment.
- Enabled: true
- VersionAdded: '0.49'
- # By default, the indentation width from `Layout/IndentationWidth` is used
- # But it can be overridden by setting this parameter
- IndentationWidth: ~
-
-Layout/IndentFirstArgument:
+Layout/FirstArgumentIndentation:
Description: 'Checks the indentation of the first argument in a method call.'
Enabled: true
VersionAdded: '0.68'
+ VersionChanged: '0.77'
EnforcedStyle: special_for_inner_method_call_in_parentheses
SupportedStyles:
# The first parameter should always be indented one step more than the
# preceding line.
- consistent
@@ -688,16 +558,17 @@
- special_for_inner_method_call_in_parentheses
# By default, the indentation width from `Layout/IndentationWidth` is used
# But it can be overridden by setting this parameter
IndentationWidth: ~
-Layout/IndentFirstArrayElement:
+Layout/FirstArrayElementIndentation:
Description: >-
Checks the indentation of the first element in an array
literal.
Enabled: true
VersionAdded: '0.68'
+ VersionChanged: '0.77'
# The value `special_inside_parentheses` means that array literals with
# brackets that have their opening bracket on the same line as a surrounding
# opening round parenthesis, shall have their first element indented relative
# to the first position inside the parenthesis.
#
@@ -714,14 +585,22 @@
- align_brackets
# By default, the indentation width from `Layout/IndentationWidth` is used
# But it can be overridden by setting this parameter
IndentationWidth: ~
-Layout/IndentFirstHashElement:
+Layout/FirstArrayElementLineBreak:
+ Description: >-
+ Checks for a line break before the first element in a
+ multi-line array.
+ Enabled: false
+ VersionAdded: '0.49'
+
+Layout/FirstHashElementIndentation:
Description: 'Checks the indentation of the first key in a hash literal.'
Enabled: true
VersionAdded: '0.68'
+ VersionChanged: '0.77'
# The value `special_inside_parentheses` means that hash literals with braces
# that have their opening brace on the same line as a surrounding opening
# round parenthesis, shall have their first key indented relative to the
# first position inside the parenthesis.
#
@@ -738,53 +617,163 @@
- align_braces
# By default, the indentation width from `Layout/IndentationWidth` is used
# But it can be overridden by setting this parameter
IndentationWidth: ~
-Layout/IndentFirstParameter:
+Layout/FirstHashElementLineBreak:
Description: >-
+ Checks for a line break before the first element in a
+ multi-line hash.
+ Enabled: false
+ VersionAdded: '0.49'
+
+Layout/FirstMethodArgumentLineBreak:
+ Description: >-
+ Checks for a line break before the first argument in a
+ multi-line method call.
+ Enabled: false
+ VersionAdded: '0.49'
+
+Layout/FirstMethodParameterLineBreak:
+ Description: >-
+ Checks for a line break before the first parameter in a
+ multi-line method parameter definition.
+ Enabled: false
+ VersionAdded: '0.49'
+
+Layout/FirstParameterIndentation:
+ Description: >-
Checks the indentation of the first parameter in a
method definition.
Enabled: true
VersionAdded: '0.49'
- VersionChanged: '0.68'
+ VersionChanged: '0.77'
EnforcedStyle: consistent
SupportedStyles:
- consistent
- align_parentheses
# By default, the indentation width from `Layout/IndentationWidth` is used
# But it can be overridden by setting this parameter
IndentationWidth: ~
-Layout/IndentHeredoc:
+Layout/HashAlignment:
+ Description: >-
+ Align the elements of a hash literal if they span more than
+ one line.
+ Enabled: true
+ AllowMultipleStyles: true
+ VersionAdded: '0.49'
+ VersionChanged: '0.77'
+ # Alignment of entries using hash rocket as separator. Valid values are:
+ #
+ # key - left alignment of keys
+ # 'a' => 2
+ # 'bb' => 3
+ # separator - alignment of hash rockets, keys are right aligned
+ # 'a' => 2
+ # 'bb' => 3
+ # table - left alignment of keys, hash rockets, and values
+ # 'a' => 2
+ # 'bb' => 3
+ EnforcedHashRocketStyle: key
+ SupportedHashRocketStyles:
+ - key
+ - separator
+ - table
+ # Alignment of entries using colon as separator. Valid values are:
+ #
+ # key - left alignment of keys
+ # a: 0
+ # bb: 1
+ # separator - alignment of colons, keys are right aligned
+ # a: 0
+ # bb: 1
+ # table - left alignment of keys and values
+ # a: 0
+ # bb: 1
+ EnforcedColonStyle: key
+ SupportedColonStyles:
+ - key
+ - separator
+ - table
+ # Select whether hashes that are the last argument in a method call should be
+ # inspected? Valid values are:
+ #
+ # always_inspect - Inspect both implicit and explicit hashes.
+ # Registers an offense for:
+ # function(a: 1,
+ # b: 2)
+ # Registers an offense for:
+ # function({a: 1,
+ # b: 2})
+ # always_ignore - Ignore both implicit and explicit hashes.
+ # Accepts:
+ # function(a: 1,
+ # b: 2)
+ # Accepts:
+ # function({a: 1,
+ # b: 2})
+ # ignore_implicit - Ignore only implicit hashes.
+ # Accepts:
+ # function(a: 1,
+ # b: 2)
+ # Registers an offense for:
+ # function({a: 1,
+ # b: 2})
+ # ignore_explicit - Ignore only explicit hashes.
+ # Accepts:
+ # function({a: 1,
+ # b: 2})
+ # Registers an offense for:
+ # function(a: 1,
+ # b: 2)
+ EnforcedLastArgumentHashStyle: always_inspect
+ SupportedLastArgumentHashStyles:
+ - always_inspect
+ - always_ignore
+ - ignore_implicit
+ - ignore_explicit
+
+Layout/HeredocArgumentClosingParenthesis:
+ Description: >-
+ Checks for the placement of the closing parenthesis in a
+ method call that passes a HEREDOC string as an argument.
+ Enabled: false
+ StyleGuide: '#heredoc-argument-closing-parentheses'
+ VersionAdded: '0.68'
+
+Layout/HeredocIndentation:
Description: 'This cop checks the indentation of the here document bodies.'
StyleGuide: '#squiggly-heredocs'
Enabled: true
VersionAdded: '0.49'
- EnforcedStyle: auto_detection
+ VersionChanged: '0.77'
+ EnforcedStyle: squiggly
SupportedStyles:
- - auto_detection
- squiggly
- active_support
- powerpack
- unindent
Layout/IndentationConsistency:
Description: 'Keep indentation straight.'
StyleGuide: '#spaces-indentation'
Enabled: true
VersionAdded: '0.49'
- # The difference between `rails` and `normal` is that the `rails` style
- # prescribes that in classes and modules the `protected` and `private`
+ # The difference between `indented` and `normal` is that the `indented_internal_methods`
+ # style prescribes that in classes and modules the `protected` and `private`
# modifier keywords shall be indented the same as public methods and that
# protected and private members shall be indented one step more than the
# modifiers. Other than that, both styles mean that entities on the same
# logical depth shall have the same indentation.
EnforcedStyle: normal
SupportedStyles:
- normal
- - rails
+ - indented_internal_methods
+ Reference:
+ # A reference to `EnforcedStyle: indented_internal_methods`.
+ - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
Layout/IndentationWidth:
Description: 'Use 2 spaces for indentation.'
StyleGuide: '#spaces-indentation'
Enabled: true
@@ -797,21 +786,24 @@
Description: >-
Checks the indentation of the first non-blank non-comment line in a file.
Enabled: true
VersionAdded: '0.49'
-Layout/LeadingBlankLines:
- Description: Check for unnecessary blank lines at the beginning of a file.
- Enabled: true
- VersionAdded: '0.57'
-
Layout/LeadingCommentSpace:
Description: 'Comments should start with a space.'
StyleGuide: '#hash-space'
Enabled: true
VersionAdded: '0.49'
+ VersionChanged: '0.73'
+ AllowDoxygenCommentStyle: false
+Layout/LeadingEmptyLines:
+ Description: Check for unnecessary blank lines at the beginning of a file.
+ Enabled: true
+ VersionAdded: '0.57'
+ VersionChanged: '0.77'
+
Layout/MultilineArrayBraceLayout:
Description: >-
Checks that the closing brace in an array literal is
either on the same line as the last array element, or
a new line.
@@ -949,10 +941,39 @@
- indented
# By default, the indentation width from `Layout/IndentationWidth` is used
# But it can be overridden by setting this parameter
IndentationWidth: ~
+Layout/ParameterAlignment:
+ Description: >-
+ Align the parameters of a method definition if they span more
+ than one line.
+ StyleGuide: '#no-double-indent'
+ Enabled: true
+ VersionAdded: '0.49'
+ VersionChanged: '0.77'
+ # Alignment of parameters in multi-line method calls.
+ #
+ # The `with_first_parameter` style aligns the following lines along the same
+ # column as the first parameter.
+ #
+ # def method_foo(a,
+ # b)
+ #
+ # The `with_fixed_indentation` style aligns the following lines with one
+ # level of indentation relative to the start of the line with the method call.
+ #
+ # def method_foo(a,
+ # b)
+ EnforcedStyle: with_first_parameter
+ SupportedStyles:
+ - with_first_parameter
+ - with_fixed_indentation
+ # By default, the indentation width from Layout/IndentationWidth is used
+ # But it can be overridden by setting this parameter
+ IndentationWidth: ~
+
Layout/RescueEnsureAlignment:
Description: 'Align rescues and ensures correctly.'
Enabled: true
VersionAdded: '0.49'
@@ -1191,15 +1212,16 @@
# But it can be overridden by setting this parameter
# It is used during auto-correction to determine how many spaces should
# replace each tab.
IndentationWidth: ~
-Layout/TrailingBlankLines:
+Layout/TrailingEmptyLines:
Description: 'Checks trailing blank lines and final newline.'
StyleGuide: '#newline-eof'
Enabled: true
VersionAdded: '0.49'
+ VersionChanged: '0.77'
EnforcedStyle: final_newline
SupportedStyles:
- final_newline
- final_blank_line
@@ -1279,20 +1301,21 @@
Lint/DuplicateCaseCondition:
Description: 'Do not repeat values in case conditionals.'
Enabled: true
VersionAdded: '0.45'
+Lint/DuplicateHashKey:
+ Description: 'Check for duplicate keys in hash literals.'
+ Enabled: true
+ VersionAdded: '0.34'
+ VersionChanged: '0.77'
+
Lint/DuplicateMethods:
Description: 'Check for duplicate method definitions.'
Enabled: true
VersionAdded: '0.29'
-Lint/DuplicatedKey:
- Description: 'Check for duplicate keys in hash literals.'
- Enabled: true
- VersionAdded: '0.34'
-
Lint/EachWithObjectArgument:
Description: 'Check for immutable argument given to each_with_object.'
Enabled: true
VersionAdded: '0.31'
@@ -1339,11 +1362,11 @@
Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
Enabled: true
VersionAdded: '0.56'
Lint/FlipFlop:
- Description: 'Checks for flip-flops'
+ Description: 'Checks for flip-flops.'
StyleGuide: '#no-flip-flops'
Enabled: true
VersionAdded: '0.16'
Lint/FloatOutOfRange:
@@ -1356,16 +1379,10 @@
Lint/FormatParameterMismatch:
Description: 'The number of parameters to format/sprint must match the fields.'
Enabled: true
VersionAdded: '0.33'
-Lint/HandleExceptions:
- Description: "Don't suppress exception."
- StyleGuide: '#dont-hide-exceptions'
- Enabled: true
- VersionAdded: '0.9'
-
Lint/HeredocMethodCallPosition:
Description: >-
Checks for the ordering of a method call where
the receiver of the call is a HEREDOC.
Enabled: false
@@ -1395,11 +1412,11 @@
SupportedStyles:
- runtime_error
- standard_error
Lint/InterpolationCheck:
- Description: 'Raise warning for interpolation in single q strs'
+ Description: 'Raise warning for interpolation in single q strs.'
Enabled: true
VersionAdded: '0.50'
Lint/LiteralAsCondition:
Description: 'Checks of literals used in conditions.'
@@ -1419,11 +1436,11 @@
StyleGuide: '#loop-with-break'
Enabled: true
VersionAdded: '0.9'
Lint/MissingCopEnableDirective:
- Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`'
+ Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
Enabled: true
VersionAdded: '0.52'
# Maximum number of consecutive lines the cop can be disabled for.
# 0 allows only single-line disables
# 1 would mean the maximum allowed is the following:
@@ -1431,14 +1448,15 @@
# a = 1
# # rubocop:enable SomeCop
# .inf for any size
MaximumRangeSize: .inf
-Lint/MultipleCompare:
- Description: "Use `&&` operator to compare multiple value."
+Lint/MultipleComparison:
+ Description: "Use `&&` operator to compare multiple values."
Enabled: true
VersionAdded: '0.47'
+ VersionChanged: '0.77'
Lint/NestedMethodDefinition:
Description: 'Do not use nested method definitions.'
StyleGuide: '#no-nested-methods'
Enabled: true
@@ -1463,10 +1481,12 @@
Lint/NumberConversion:
Description: 'Checks unsafe usage of number conversion methods.'
Enabled: false
VersionAdded: '0.53'
+ VersionChanged: '0.70'
+ SafeAutoCorrect: false
Lint/OrderedMagicComments:
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
Enabled: true
VersionAdded: '0.53'
@@ -1481,10 +1501,11 @@
Lint/PercentStringArray:
Description: >-
Checks for unwanted commas and quotes in %w/%W literals.
Enabled: true
+ Safe: false
VersionAdded: '0.41'
Lint/PercentSymbolArray:
Description: >-
Checks for unwanted commas and colons in %i/%I literals.
@@ -1496,10 +1517,40 @@
Checks for `rand(1)` calls. Such calls always return `0`
and most likely a mistake.
Enabled: true
VersionAdded: '0.36'
+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
+ VersionAdded: '0.76'
+
+Lint/RedundantCopEnableDirective:
+ Description: Checks for rubocop:enable comments that can be removed.
+ Enabled: true
+ VersionAdded: '0.76'
+
+Lint/RedundantRequireStatement:
+ Description: 'Checks for unnecessary `require` statement.'
+ Enabled: true
+ VersionAdded: '0.76'
+
+Lint/RedundantSplatExpansion:
+ Description: 'Checks for splat unnecessarily being called on literals.'
+ Enabled: true
+ VersionChanged: '0.76'
+
+Lint/RedundantStringCoercion:
+ Description: 'Checks for Object#to_s usage in string interpolation.'
+ StyleGuide: '#no-to-s'
+ Enabled: true
+ VersionAdded: '0.19'
+ VersionChanged: '0.77'
+
Lint/RedundantWithIndex:
Description: 'Checks for redundant `with_index`.'
Enabled: true
VersionAdded: '0.50'
@@ -1541,12 +1592,12 @@
Lint/SafeNavigationChain:
Description: 'Do not chain ordinary method call after safe navigation operator.'
Enabled: true
VersionAdded: '0.47'
- VersionChanged: '0.56'
- Whitelist:
+ VersionChanged: '0.77'
+ AllowedMethods:
- present?
- blank?
- presence
- try
- try!
@@ -1556,18 +1607,18 @@
Check to make sure that if safe navigation is used for a method
call in an `&&` or `||` condition that safe navigation is used
for all method calls on that same object.
Enabled: true
VersionAdded: '0.55'
- Whitelist:
+ VersionChanged: '0.77'
+ AllowedMethods:
- present?
- blank?
- presence
- try
- try!
-
Lint/SafeNavigationWithEmpty:
Description: 'Avoid `foo&.empty?` in conditionals.'
Enabled: true
VersionAdded: '0.62'
@@ -1575,10 +1626,15 @@
Description: 'Grant script file execute permission.'
Enabled: true
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
VersionAdded: '0.52'
IgnoreImplicitReferences: false
@@ -1596,19 +1652,20 @@
Do not use the same name as outer local variable
for block arguments or block local variables.
Enabled: true
VersionAdded: '0.9'
-Lint/StringConversionInInterpolation:
- Description: 'Checks for Object#to_s usage in string interpolation.'
- StyleGuide: '#no-to-s'
+Lint/SuppressedException:
+ Description: "Don't suppress exceptions."
+ StyleGuide: '#dont-hide-exceptions'
Enabled: true
- VersionAdded: '0.19'
- VersionChanged: '0.20'
+ AllowComments: false
+ VersionAdded: '0.9'
+ VersionChanged: '0.77'
Lint/Syntax:
- Description: 'Checks syntax error'
+ Description: 'Checks syntax error.'
Enabled: true
VersionAdded: '0.9'
Lint/ToJSON:
@@ -1620,37 +1677,14 @@
Enabled: true
VersionAdded: '0.21'
AllowKeywordBlockArguments: false
Lint/UnifiedInteger:
- Description: 'Use Integer instead of Fixnum or Bignum'
+ Description: 'Use Integer instead of Fixnum or Bignum.'
Enabled: true
VersionAdded: '0.43'
-Lint/UnneededCopDisableDirective:
- 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
- VersionAdded: '0.53'
-
-Lint/UnneededCopEnableDirective:
- Description: Checks for rubocop:enable comments that can be removed.
- Enabled: true
- VersionAdded: '0.53'
-
-Lint/UnneededRequireStatement:
- Description: 'Checks for unnecessary `require` statement.'
- Enabled: true
- VersionAdded: '0.51'
-
-Lint/UnneededSplatExpansion:
- Description: 'Checks for splat unnecessarily being called on literals'
- Enabled: true
- VersionAdded: '0.43'
-
Lint/UnreachableCode:
Description: 'Unreachable code.'
Enabled: true
VersionAdded: '0.9'
@@ -1729,11 +1763,11 @@
Description: >-
A calculated magnitude based on number of assignments,
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'
# The ABC size is a calculated magnitude, so this number can be an Integer or
# a Float.
@@ -1752,11 +1786,11 @@
- refine
Exclude:
- '**/*.gemspec'
Metrics/BlockNesting:
- Description: 'Avoid excessive block nesting'
+ Description: 'Avoid excessive block nesting.'
StyleGuide: '#three-is-the-number-thou-shalt-count'
Enabled: true
VersionAdded: '0.25'
VersionChanged: '0.47'
CountBlocks: false
@@ -1793,11 +1827,11 @@
URISchemes:
- http
- 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.
IgnoredPatterns: []
@@ -1832,10 +1866,18 @@
human reader.
Enabled: true
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:
Description: Check the naming of accessor methods for get_/set_.
StyleGuide: '#accessor_mutator_method_names'
@@ -1852,10 +1894,25 @@
Description: 'When defining binary operators, name the argument other.'
StyleGuide: '#other-arg'
Enabled: true
VersionAdded: '0.50'
+Naming/BlockParameterName:
+ Description: >-
+ Checks for block parameter names that contain capital letters,
+ end in numbers, or do not meet a minimal length.
+ Enabled: true
+ VersionAdded: '0.53'
+ VersionChanged: '0.77'
+ # Parameter names may be equal to or greater than this value
+ MinNameLength: 1
+ AllowNamesEndingInNumbers: true
+ # Allowed names that will not register an offense
+ AllowedNames: []
+ # Forbidden names that will register an offense
+ ForbiddenNames: []
+
Naming/ClassAndModuleCamelCase:
Description: 'Use CamelCase for classes and modules.'
StyleGuide: '#camelcase-classes'
Enabled: true
VersionAdded: '0.50'
@@ -1943,11 +2000,11 @@
Naming/HeredocDelimiterNaming:
Description: 'Use descriptive heredoc delimiters.'
StyleGuide: '#heredoc-delimiters'
Enabled: true
VersionAdded: '0.50'
- Blacklist:
+ ForbiddenDelimiters:
- !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
Naming/MemoizedInstanceVariableName:
Description: >-
Memoized method name should match memo instance variable name.
@@ -1967,30 +2024,62 @@
VersionAdded: '0.50'
EnforcedStyle: snake_case
SupportedStyles:
- snake_case
- camelCase
+ # Method names matching patterns are always allowed.
+ #
+ # IgnoredPatterns:
+ # - '\A\s*onSelectionBulkChange\s*'
+ # - '\A\s*onSelectionCleared\s*'
+ #
+ IgnoredPatterns: []
+Naming/MethodParameterName:
+ Description: >-
+ Checks for method parameter names that contain capital letters,
+ end in numbers, or do not meet a minimal length.
+ Enabled: true
+ VersionAdded: '0.53'
+ VersionChanged: '0.77'
+ # Parameter names may be equal to or greater than this value
+ MinNameLength: 3
+ AllowNamesEndingInNumbers: true
+ # Allowed names that will not register an offense
+ AllowedNames:
+ - io
+ - id
+ - to
+ - by
+ - 'on'
+ - in
+ - at
+ - ip
+ - db
+ - os
+ # Forbidden names that will register an offense
+ ForbiddenNames: []
+
Naming/PredicateName:
Description: 'Check the names of predicate methods.'
StyleGuide: '#bool-methods-qmark'
Enabled: true
VersionAdded: '0.50'
- VersionChanged: '0.51'
+ VersionChanged: '0.77'
# Predicate name prefixes.
NamePrefix:
- is_
- has_
- have_
# Predicate name prefixes that should be removed.
- NamePrefixBlacklist:
+ ForbiddenPrefixes:
- is_
- has_
- have_
- # Predicate names which, despite having a blacklisted prefix, or no `?`,
+ # Predicate names which, despite having a forbidden prefix, or no `?`,
# should still be accepted
- NameWhitelist:
+ AllowedMethods:
- is_a?
# Method definition macros for dynamically generated methods.
MethodDefinitionMacros:
- define_method
- define_singleton_method
@@ -2004,49 +2093,10 @@
Enabled: true
VersionAdded: '0.67'
VersionChanged: '0.68'
PreferredName: e
-Naming/UncommunicativeBlockParamName:
- Description: >-
- Checks for block parameter names that contain capital letters,
- end in numbers, or do not meet a minimal length.
- Enabled: true
- VersionAdded: '0.53'
- # Parameter names may be equal to or greater than this value
- MinNameLength: 1
- AllowNamesEndingInNumbers: true
- # Whitelisted names that will not register an offense
- AllowedNames: []
- # Blacklisted names that will register an offense
- ForbiddenNames: []
-
-Naming/UncommunicativeMethodParamName:
- Description: >-
- Checks for method parameter names that contain capital letters,
- end in numbers, or do not meet a minimal length.
- Enabled: true
- VersionAdded: '0.53'
- VersionChanged: '0.59'
- # Parameter names may be equal to or greater than this value
- MinNameLength: 3
- AllowNamesEndingInNumbers: true
- # Whitelisted names that will not register an offense
- AllowedNames:
- - io
- - id
- - to
- - by
- - 'on'
- - in
- - at
- - ip
- - db
- # Blacklisted names that will register an offense
- ForbiddenNames: []
-
-
Naming/VariableName:
Description: 'Use the configured style when naming variables.'
StyleGuide: '#snake-case-symbols-methods-vars'
Enabled: true
VersionAdded: '0.50'
@@ -2063,462 +2113,10 @@
SupportedStyles:
- snake_case
- normalcase
- non_integer
-#################### Rails #################################
-
-# By default, the rails cops are not run. Override in project or home
-# directory .rubocop.yml files, or by giving the -R/--rails option.
-Rails:
- Enabled: false
-
-Rails/ActionFilter:
- Description: 'Enforces consistent use of action filter methods.'
- Enabled: true
- VersionAdded: '0.19'
- EnforcedStyle: action
- SupportedStyles:
- - action
- - filter
- Include:
- - app/controllers/**/*.rb
-
-Rails/ActiveRecordAliases:
- Description: >-
- Avoid Active Record aliases:
- Use `update` instead of `update_attributes`.
- Use `update!` instead of `update_attributes!`.
- Enabled: true
- VersionAdded: '0.53'
-
-Rails/ActiveRecordOverride:
- Description: >-
- Check for overriding Active Record methods instead of using
- callbacks.
- Enabled: true
- VersionAdded: '0.67'
- Include:
- - app/models/**/*.rb
-
-Rails/ActiveSupportAliases:
- Description: >-
- Avoid ActiveSupport aliases of standard ruby methods:
- `String#starts_with?`, `String#ends_with?`,
- `Array#append`, `Array#prepend`.
- Enabled: true
- VersionAdded: '0.48'
-
-Rails/ApplicationJob:
- Description: 'Check that jobs subclass ApplicationJob.'
- Enabled: true
- VersionAdded: '0.49'
-
-Rails/ApplicationRecord:
- Description: 'Check that models subclass ApplicationRecord.'
- Enabled: true
- VersionAdded: '0.49'
-
-Rails/AssertNot:
- Description: 'Use `assert_not` instead of `assert !`.'
- Enabled: true
- VersionAdded: '0.56'
- Include:
- - '**/test/**/*'
-
-Rails/BelongsTo:
- Description: >-
- Use `optional: true` instead of `required: false` for
- `belongs_to` relations'
- Enabled: true
- VersionAdded: '0.62'
-
-Rails/Blank:
- Description: 'Enforces use of `blank?`.'
- Enabled: true
- VersionAdded: '0.48'
- VersionChanged: '0.67'
- # Convert usages of `nil? || empty?` to `blank?`
- NilOrEmpty: true
- # Convert usages of `!present?` to `blank?`
- NotPresent: true
- # Convert usages of `unless present?` to `if blank?`
- UnlessPresent: true
-
-Rails/BulkChangeTable:
- Description: 'Check whether alter queries are combinable.'
- Enabled: true
- VersionAdded: '0.57'
- Database: null
- SupportedDatabases:
- - mysql
- - postgresql
- Include:
- - db/migrate/*.rb
-
-Rails/CreateTableWithTimestamps:
- Description: >-
- Checks the migration for which timestamps are not included
- when creating a new table.
- Enabled: true
- VersionAdded: '0.52'
- Include:
- - db/migrate/*.rb
-
-Rails/Date:
- Description: >-
- Checks the correct usage of date aware methods,
- such as Date.today, Date.current etc.
- Enabled: true
- VersionAdded: '0.30'
- VersionChanged: '0.33'
- # The value `strict` disallows usage of `Date.today`, `Date.current`,
- # `Date#to_time` etc.
- # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
- # (but not `Date.today`) which are overridden by ActiveSupport to handle current
- # time zone.
- EnforcedStyle: flexible
- SupportedStyles:
- - strict
- - flexible
-
-Rails/Delegate:
- Description: 'Prefer delegate method for delegations.'
- Enabled: true
- VersionAdded: '0.21'
- VersionChanged: '0.50'
- # When set to true, using the target object as a prefix of the
- # method name without using the `delegate` method will be a
- # violation. When set to false, this case is legal.
- EnforceForPrefixed: true
-
-Rails/DelegateAllowBlank:
- Description: 'Do not use allow_blank as an option to delegate.'
- Enabled: true
- VersionAdded: '0.44'
-
-Rails/DynamicFindBy:
- Description: 'Use `find_by` instead of dynamic `find_by_*`.'
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
- Enabled: true
- VersionAdded: '0.44'
- Whitelist:
- - find_by_sql
-
-Rails/EnumUniqueness:
- Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
- Enabled: true
- VersionAdded: '0.46'
- Include:
- - app/models/**/*.rb
-
-Rails/EnvironmentComparison:
- Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
- Enabled: true
- VersionAdded: '0.52'
-
-Rails/Exit:
- Description: >-
- Favor `fail`, `break`, `return`, etc. over `exit` in
- application or library code outside of Rake files to avoid
- exits during unit testing or running in production.
- Enabled: true
- VersionAdded: '0.41'
- Include:
- - app/**/*.rb
- - config/**/*.rb
- - lib/**/*.rb
- Exclude:
- - lib/**/*.rake
-
-Rails/FilePath:
- Description: 'Use `Rails.root.join` for file path joining.'
- Enabled: true
- VersionAdded: '0.47'
- VersionChanged: '0.57'
- EnforcedStyle: arguments
- SupportedStyles:
- - slashes
- - arguments
-
-Rails/FindBy:
- Description: 'Prefer find_by over where.first.'
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
- Enabled: true
- VersionAdded: '0.30'
- Include:
- - app/models/**/*.rb
-
-Rails/FindEach:
- Description: 'Prefer all.find_each over all.find.'
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find-each'
- Enabled: true
- VersionAdded: '0.30'
- Include:
- - app/models/**/*.rb
-
-Rails/HasAndBelongsToMany:
- Description: 'Prefer has_many :through to has_and_belongs_to_many.'
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has-many-through'
- Enabled: true
- VersionAdded: '0.12'
- Include:
- - app/models/**/*.rb
-
-Rails/HasManyOrHasOneDependent:
- Description: 'Define the dependent option to the has_many and has_one associations.'
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option'
- Enabled: true
- VersionAdded: '0.50'
- Include:
- - app/models/**/*.rb
-
-Rails/HttpPositionalArguments:
- Description: 'Use keyword arguments instead of positional arguments in http method calls.'
- Enabled: true
- VersionAdded: '0.44'
- Include:
- - 'spec/**/*'
- - 'test/**/*'
-
-Rails/HttpStatus:
- Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
- Enabled: true
- VersionAdded: '0.54'
- EnforcedStyle: symbolic
- SupportedStyles:
- - numeric
- - symbolic
-
-Rails/IgnoredSkipActionFilterOption:
- Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
- Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
- Enabled: true
- VersionAdded: '0.63'
- Include:
- - app/controllers/**/*.rb
-
-Rails/InverseOf:
- Description: 'Checks for associations where the inverse cannot be determined automatically.'
- Enabled: true
- VersionAdded: '0.52'
- Include:
- - app/models/**/*.rb
-
-Rails/LexicallyScopedActionFilter:
- Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
- Enabled: true
- Safe: false
- VersionAdded: '0.52'
- Include:
- - app/controllers/**/*.rb
-
-Rails/LinkToBlank:
- Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
- Reference: https://mathiasbynens.github.io/rel-noopener/
- Enabled: true
- VersionAdded: '0.62'
-
-Rails/NotNullColumn:
- Description: 'Do not add a NOT NULL column without a default value'
- Enabled: true
- VersionAdded: '0.43'
- Include:
- - db/migrate/*.rb
-
-Rails/Output:
- Description: 'Checks for calls to puts, print, etc.'
- Enabled: true
- VersionAdded: '0.15'
- VersionChanged: '0.19'
- Include:
- - app/**/*.rb
- - config/**/*.rb
- - db/**/*.rb
- - lib/**/*.rb
-
-Rails/OutputSafety:
- Description: 'The use of `html_safe` or `raw` may be a security risk.'
- Enabled: true
- VersionAdded: '0.41'
-
-Rails/PluralizationGrammar:
- Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
- Enabled: true
- VersionAdded: '0.35'
-
-Rails/Presence:
- Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
- Enabled: true
- VersionAdded: '0.52'
-
-Rails/Present:
- Description: 'Enforces use of `present?`.'
- Enabled: true
- VersionAdded: '0.48'
- VersionChanged: '0.67'
- # Convert usages of `!nil? && !empty?` to `present?`
- NotNilAndNotEmpty: true
- # Convert usages of `!blank?` to `present?`
- NotBlank: true
- # Convert usages of `unless blank?` to `if present?`
- UnlessBlank: true
-
-Rails/ReadWriteAttribute:
- Description: >-
- Checks for read_attribute(:attr) and
- write_attribute(:attr, val).
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
- Enabled: true
- VersionAdded: '0.20'
- VersionChanged: '0.29'
- Include:
- - app/models/**/*.rb
-
-Rails/RedundantAllowNil:
- Description: >-
- Finds redundant use of `allow_nil` when `allow_blank` is set to
- certain values in model validations.
- Enabled: true
- VersionAdded: '0.67'
- Include:
- - app/models/**/*.rb
-
-Rails/RedundantReceiverInWithOptions:
- Description: 'Checks for redundant receiver in `with_options`.'
- Enabled: true
- VersionAdded: '0.52'
-
-Rails/ReflectionClassName:
- Description: 'Use a string for `class_name` option value in the definition of a reflection.'
- Enabled: true
- VersionAdded: '0.64'
-
-Rails/RefuteMethods:
- Description: 'Use `assert_not` methods instead of `refute` methods.'
- Enabled: true
- VersionAdded: '0.56'
- Include:
- - '**/test/**/*'
-
-Rails/RelativeDateConstant:
- Description: 'Do not assign relative date to constants.'
- Enabled: true
- VersionAdded: '0.48'
- VersionChanged: '0.59'
- AutoCorrect: false
-
-Rails/RequestReferer:
- Description: 'Use consistent syntax for request.referer.'
- Enabled: true
- VersionAdded: '0.41'
- EnforcedStyle: referer
- SupportedStyles:
- - referer
- - referrer
-
-Rails/ReversibleMigration:
- Description: 'Checks whether the change method of the migration file is reversible.'
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#reversible-migration'
- Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
- Enabled: true
- VersionAdded: '0.47'
- Include:
- - db/migrate/*.rb
-
-Rails/SafeNavigation:
- Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
- Enabled: true
- VersionAdded: '0.43'
- # This will convert usages of `try` to use safe navigation as well as `try!`.
- # `try` and `try!` work slightly differently. `try!` and safe navigation will
- # both raise a `NoMethodError` if the receiver of the method call does not
- # implement the intended method. `try` will not raise an exception for this.
- ConvertTry: false
-
-Rails/SaveBang:
- Description: 'Identifies possible cases where Active Record save! or related should be used.'
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#save-bang'
- Enabled: false
- VersionAdded: '0.42'
- VersionChanged: '0.59'
- AllowImplicitReturn: true
- AllowedReceivers: []
-
-Rails/ScopeArgs:
- Description: 'Checks the arguments of ActiveRecord scopes.'
- Enabled: true
- VersionAdded: '0.19'
- Include:
- - app/models/**/*.rb
-
-Rails/SkipsModelValidations:
- Description: >-
- Use methods that skips model validations with caution.
- See reference for more information.
- Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
- Enabled: true
- VersionAdded: '0.47'
- VersionChanged: '0.60'
- Blacklist:
- - decrement!
- - decrement_counter
- - increment!
- - increment_counter
- - toggle!
- - touch
- - update_all
- - update_attribute
- - update_column
- - update_columns
- - update_counters
- Whitelist: []
-
-Rails/TimeZone:
- Description: 'Checks the correct usage of time zone aware methods.'
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
- Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
- Enabled: true
- Safe: false
- VersionAdded: '0.30'
- VersionChanged: '0.68'
- # The value `strict` means that `Time` should be used with `zone`.
- # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
- EnforcedStyle: flexible
- SupportedStyles:
- - strict
- - flexible
-
-Rails/UniqBeforePluck:
- Description: 'Prefer the use of uniq or distinct before pluck.'
- Enabled: true
- VersionAdded: '0.40'
- VersionChanged: '0.47'
- EnforcedStyle: conservative
- SupportedStyles:
- - conservative
- - aggressive
- AutoCorrect: false
-
-Rails/UnknownEnv:
- Description: 'Use correct environment name.'
- Enabled: true
- VersionAdded: '0.51'
- Environments:
- - development
- - test
- - production
-
-Rails/Validation:
- Description: 'Use validates :attribute, hash of validations.'
- Enabled: true
- VersionAdded: '0.9'
- VersionChanged: '0.41'
- Include:
- - app/models/**/*.rb
-
#################### Security ##############################
Security/Eval:
Description: 'The use of eval represents a serious security risk.'
Enabled: true
@@ -2571,11 +2169,11 @@
- inline
- group
Style/Alias:
Description: 'Use alias instead of alias_method.'
- StyleGuide: '#alias-method'
+ StyleGuide: '#alias-method-lexically'
Enabled: true
VersionAdded: '0.9'
VersionChanged: '0.36'
EnforcedStyle: prefer_alias
SupportedStyles:
@@ -2922,10 +2520,17 @@
# will only register an offense for assignment to a condition that has
# at least one multiline branch.
SingleLineConditionsOnly: true
IncludeTernaryExpressions: true
+Style/ConstantVisibility:
+ Description: >-
+ Check that class- and module constants have
+ visibility declarations.
+ Enabled: false
+ VersionAdded: '0.66'
+
# Checks that you have put a copyright in a comment before any code.
#
# You can override the default Notice in your .rubocop.yml file.
#
# In order to use autocorrect, you must supply a value for the
@@ -2940,17 +2545,10 @@
# Style/Copyright:
# Enabled: true
# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
# AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
#
-Style/ConstantVisibility:
- Description: >-
- Check that class- and module constants have
- visibility declarations.
- Enabled: false
- VersionAdded: '0.66'
-
Style/Copyright:
Description: 'Include a copyright notice in each file before any code.'
Enabled: false
VersionAdded: '0.30'
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
@@ -2993,10 +2591,15 @@
Exclude:
- 'spec/**/*'
- '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'
Enabled: true
VersionAdded: '0.19'
@@ -3077,21 +2680,34 @@
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
Enabled: true
VersionAdded: '0.52'
Style/EvenOdd:
- Description: 'Favor the use of Integer#even? && Integer#odd?'
+ Description: 'Favor the use of `Integer#even?` && `Integer#odd?`.'
StyleGuide: '#predicate-methods'
Enabled: true
VersionAdded: '0.12'
VersionChanged: '0.29'
Style/ExpandPathArguments:
Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
Enabled: true
VersionAdded: '0.53'
+Style/FloatDivision:
+ Description: 'For performing float division, coerce one side only.'
+ StyleGuide: '#float-division'
+ Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
+ Enabled: true
+ VersionAdded: '0.72'
+ EnforcedStyle: single_coerce
+ SupportedStyles:
+ - left_coerce
+ - right_coerce
+ - single_coerce
+ - fdiv
+
Style/For:
Description: 'Checks use of for or each in multiline loops.'
StyleGuide: '#no-for-loops'
Enabled: true
VersionAdded: '0.13'
@@ -3123,24 +2739,21 @@
- annotated
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
- template
- unannotated
VersionAdded: '0.49'
- VersionChanged: '0.52'
+ VersionChanged: '0.75'
Style/FrozenStringLiteralComment:
Description: >-
Add the frozen_string_literal comment to the top of files
to help transition to frozen string literals by default.
Enabled: true
VersionAdded: '0.36'
- VersionChanged: '0.47'
- EnforcedStyle: when_needed
+ VersionChanged: '0.69'
+ EnforcedStyle: always
SupportedStyles:
- # `when_needed` will add the frozen string literal comment to files
- # only when the `TargetRubyVersion` is set to 2.3+.
- - when_needed
# `always` will always add the frozen string literal comment to a file
# regardless of the Ruby version or if `freeze` or `<<` are called on a
# string literal. If you run code against multiple versions of Ruby, it is
# possible that this will create errors in Ruby 2.3.0+.
- always
@@ -3156,11 +2769,11 @@
VersionAdded: '0.13'
# Built-in global variables are allowed by default.
AllowedVariables: []
Style/GuardClause:
- Description: 'Check for conditionals that can be replaced with guard clauses'
+ Description: 'Check for conditionals that can be replaced with guard clauses.'
StyleGuide: '#no-nested-conditionals'
Enabled: true
VersionAdded: '0.20'
VersionChanged: '0.22'
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
@@ -3199,10 +2812,11 @@
VersionAdded: '0.36'
Style/IfInsideElse:
Description: 'Finds if nodes inside else, which can be converted to elsif.'
Enabled: true
+ AllowIfModifier: false
VersionAdded: '0.36'
Style/IfUnlessModifier:
Description: >-
Favor modifier if/unless usage when you have a
@@ -3273,12 +2887,13 @@
Style/IpAddresses:
Description: "Don't include literal IP addresses in code."
Enabled: false
VersionAdded: '0.58'
- # Allow strings to be whitelisted
- Whitelist:
+ VersionChanged: '0.77'
+ # Allow addresses to be permitted
+ AllowedAddresses:
- "::"
# :: is a valid IPv6 address, but could potentially be legitimately in code
Style/Lambda:
Description: 'Use the new lambda literal syntax for single-line blocks.'
@@ -3318,10 +2933,11 @@
Enabled: false
VersionAdded: '0.47'
VersionChanged: '0.61'
IgnoreMacros: true
IgnoredMethods: []
+ IgnoredPatterns: []
IncludedMacros: []
AllowParenthesesInMultilineCall: false
AllowParenthesesInChaining: false
AllowParenthesesInCamelCaseMethod: false
EnforcedStyle: require_parentheses
@@ -3364,21 +2980,21 @@
VersionAdded: '0.56'
Style/MinMax:
Description: >-
Use `Enumerable#minmax` instead of `Enumerable#min`
- and `Enumerable#max` in conjunction.'
+ and `Enumerable#max` in conjunction.
Enabled: true
VersionAdded: '0.50'
Style/MissingElse:
Description: >-
Require if/case expressions to have an else branches.
If enabled, it is recommended that
Style/UnlessElse and Style/EmptyElse be enabled.
This will conflict with Style/EmptyElse if
- Style/EmptyElse is configured to style "both"
+ Style/EmptyElse is configured to style "both".
Enabled: false
VersionAdded: '0.30'
VersionChanged: '0.38'
EnforcedStyle: both
SupportedStyles:
@@ -3468,10 +3084,16 @@
use if/unless instead.
StyleGuide: '#no-multiline-ternary'
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,
use Array#include? instead.
Enabled: true
@@ -3508,10 +3130,24 @@
# postfix: only use `unless` for negated `if` statements positioned after the body of the statement
- both
- prefix
- postfix
+Style/NegatedUnless:
+ Description: 'Favor if over unless for negative conditions.'
+ StyleGuide: '#if-for-negatives'
+ Enabled: true
+ VersionAdded: '0.69'
+ EnforcedStyle: both
+ SupportedStyles:
+ # both: prefix and postfix negated `unless` should both use `if`
+ # prefix: only use `if` for negated `unless` statements positioned before the body of the statement
+ # postfix: only use `if` for negated `unless` statements positioned after the body of the statement
+ - both
+ - prefix
+ - postfix
+
Style/NegatedWhile:
Description: 'Favor until over while for negative conditions.'
StyleGuide: '#until-for-negatives'
Enabled: true
VersionAdded: '0.20'
@@ -3526,12 +3162,12 @@
Description: >-
Parenthesize method calls which are nested inside the
argument list of another parenthesized method call.
Enabled: true
VersionAdded: '0.36'
- VersionChanged: '0.50'
- Whitelist:
+ VersionChanged: '0.77'
+ AllowedMethods:
- be
- be_a
- be_an
- be_between
- be_falsey
@@ -3672,11 +3308,11 @@
- parameters
Style/OptionalArguments:
Description: >-
Checks for optional arguments that do not appear at the end
- of the argument list
+ of the argument list.
StyleGuide: '#optional-arguments'
Enabled: true
VersionAdded: '0.33'
Style/OrAssignment:
@@ -3704,11 +3340,11 @@
VersionChanged: '0.56'
AllowSafeAssignment: true
AllowInMultilineConditions: false
Style/PercentLiteralDelimiters:
- Description: 'Use `%`-literal delimiters consistently'
+ Description: 'Use `%`-literal delimiters consistently.'
StyleGuide: '#percent-literal-braces'
Enabled: true
VersionAdded: '0.19'
# Specify the default preferred delimiter for all types with the 'default' key
# Override individual delimiters (even with default specified) by specifying
@@ -3739,12 +3375,13 @@
Style/PreferredHashMethods:
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
StyleGuide: '#hash-key'
Enabled: true
+ Safe: false
VersionAdded: '0.41'
- VersionChanged: '0.44'
+ VersionChanged: '0.70'
EnforcedStyle: short
SupportedStyles:
- short
- verbose
@@ -3779,10 +3416,20 @@
StyleGuide: '#begin-implicit'
Enabled: true
VersionAdded: '0.10'
VersionChanged: '0.21'
+Style/RedundantCapitalW:
+ Description: 'Checks for %W when interpolation is not needed.'
+ Enabled: true
+ VersionAdded: '0.76'
+
+Style/RedundantCondition:
+ Description: 'Checks for unnecessary conditional expressions.'
+ Enabled: true
+ VersionAdded: '0.76'
+
Style/RedundantConditional:
Description: "Don't return true/false from a conditional."
Enabled: true
VersionAdded: '0.50'
@@ -3797,15 +3444,26 @@
Description: "Checks usages of Object#freeze on immutable objects."
Enabled: true
VersionAdded: '0.34'
VersionChanged: '0.66'
+Style/RedundantInterpolation:
+ Description: 'Checks for strings that are just an interpolated expression.'
+ Enabled: true
+ VersionAdded: '0.76'
+
Style/RedundantParentheses:
Description: "Checks for parentheses that seem not to serve any purpose."
Enabled: true
VersionAdded: '0.36'
+Style/RedundantPercentQ:
+ Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
+ StyleGuide: '#percent-q'
+ Enabled: true
+ VersionAdded: '0.76'
+
Style/RedundantReturn:
Description: "Don't use return where it's not required."
StyleGuide: '#no-explicit-return'
Enabled: true
VersionAdded: '0.10'
@@ -3818,10 +3476,17 @@
StyleGuide: '#no-self-unless-required'
Enabled: true
VersionAdded: '0.10'
VersionChanged: '0.13'
+Style/RedundantSort:
+ Description: >-
+ Use `min` instead of `sort.first`,
+ `max_by` instead of `sort_by...last`, etc.
+ Enabled: true
+ VersionAdded: '0.76'
+
Style/RedundantSortBy:
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
Enabled: true
VersionAdded: '0.36'
@@ -3875,15 +3540,15 @@
This cop transforms usages of a method call safeguarded by
a check for the existence of the object to
safe navigation (`&.`).
Enabled: true
VersionAdded: '0.43'
- VersionChanged: '0.56'
+ VersionChanged: '0.77'
# Safe navigation may cause a statement to start returning `nil` in addition
# to whatever it used to return.
ConvertCodeThatCanStartToReturnNil: false
- Whitelist:
+ AllowedMethods:
- present?
- blank?
- presence
- try
- try!
@@ -3984,10 +3649,12 @@
Style/StringHashKeys:
Description: 'Prefer symbols instead of strings as hash keys.'
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.'
StyleGuide: '#consistent-string-literals'
Enabled: true
@@ -4155,11 +3822,11 @@
Style/TrivialAccessors:
Description: 'Prefer attr_* methods to trivial readers/writers.'
StyleGuide: '#attr_family'
Enabled: true
VersionAdded: '0.9'
- VersionChanged: '0.38'
+ VersionChanged: '0.77'
# When set to `false` the cop will suggest the use of accessor methods
# in situations like:
#
# def name
# @other_name
@@ -4176,11 +3843,11 @@
# on_exception :restart
#
# Commonly used in DSLs
AllowDSLWriters: false
IgnoreClassMethods: false
- Whitelist:
+ AllowedMethods:
- to_ary
- to_a
- to_c
- to_enum
- to_h
@@ -4203,43 +3870,14 @@
case first.
StyleGuide: '#no-else-with-unless'
Enabled: true
VersionAdded: '0.9'
-Style/UnneededCapitalW:
- Description: 'Checks for %W when interpolation is not needed.'
- Enabled: true
- VersionAdded: '0.21'
- VersionChanged: '0.24'
-
-Style/UnneededCondition:
- Description: 'Checks for unnecessary conditional expressions.'
- Enabled: true
- VersionAdded: '0.57'
-
-Style/UnneededInterpolation:
- Description: 'Checks for strings that are just an interpolated expression.'
- Enabled: true
- VersionAdded: '0.36'
-
-Style/UnneededPercentQ:
- Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
- StyleGuide: '#percent-q'
- Enabled: true
- VersionAdded: '0.24'
-
-Style/UnneededSort:
- Description: >-
- Use `min` instead of `sort.first`,
- `max_by` instead of `sort_by...last`, etc.
- Enabled: true
- VersionAdded: '0.55'
-
Style/UnpackFirst:
Description: >-
Checks for accessing the first element of `String#unpack`
- instead of using `unpack1`
+ instead of using `unpack1`.
Enabled: true
VersionAdded: '0.54'
Style/VariableInterpolation:
Description: >-
@@ -4286,11 +3924,11 @@
# The `MinSize` option causes the `WordArray` rule to be ignored for arrays
# smaller than a certain size. The rule is only applied to arrays
# whose element count is greater than or equal to `MinSize`.
MinSize: 2
# The regular expression `WordRegex` decides what is considered a word.
- WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
+ WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
Style/YodaCondition:
Description: 'Forbid or enforce yoda conditions.'
Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
Enabled: true
@@ -4302,11 +3940,12 @@
- forbid_for_equality_operators_only
# enforce yoda for all comparison operators
- 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.'
Enabled: true
Safe: false