config/upstream.yml in cookstyle-5.23.0 vs config/upstream.yml in cookstyle-6.0.19

- old
+ new

@@ -52,15 +52,17 @@ - '**/Mavenfile' - '**/Podfile' - '**/Puppetfile' - '**/Rakefile' - '**/Snapfile' + - '**/Steepfile' - '**/Thorfile' - '**/Vagabondfile' - '**/Vagrantfile' Exclude: - 'node_modules/**/*' + - 'tmp/**/*' - 'vendor/**/*' - '.git/**/*' # Default formatter will be used if no `-f/--format` option is given. DefaultFormatter: progress # Cop names are displayed in offense messages by default. Change behavior @@ -139,15 +141,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 @@ -193,13 +196,14 @@ 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. + StyleGuide: '#no-ruby-version-in-the-gemspec' Enabled: true VersionAdded: '0.72' Include: - '**/*.gemspec' @@ -216,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. # @@ -244,121 +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 - AllowMultipleStyles: 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.' @@ -622,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 @@ -692,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. # @@ -718,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. # @@ -742,31 +617,138 @@ - 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' - VersionChanged: '0.69' + VersionChanged: '0.77' EnforcedStyle: squiggly SupportedStyles: - squiggly - active_support - powerpack @@ -804,23 +786,48 @@ 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 + AllowGemfileRubyComment: false +Layout/LeadingEmptyLines: + Description: Check for unnecessary blank lines at the beginning of a file. + Enabled: true + VersionAdded: '0.57' + VersionChanged: '0.77' + +Layout/LineLength: + Description: 'Limit lines to 80 characters.' + StyleGuide: '#80-character-limits' + Enabled: true + VersionAdded: '0.25' + VersionChanged: '0.78' + AutoCorrect: false + Max: 80 + # To make it possible to copy or click on URIs in the code, we allow lines + # containing a URI to be longer than Max. + AllowHeredoc: true + AllowURI: true + URISchemes: + - http + - https + # The IgnoreCopDirectives option causes the LineLength rule to ignore cop + # directives like '# rubocop: enable ...' when calculating a line's length. + 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: [] + 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. @@ -958,10 +965,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' @@ -1031,10 +1067,14 @@ VersionAdded: '0.49' # When `true`, allows most uses of extra spacing if the intent is to align # with an operator on the previous or next line, not counting empty lines # or comment lines. AllowForAlignment: true + EnforcedStyleForExponentOperator: no_space + SupportedStylesForExponentOperator: + - space + - no_space Layout/SpaceBeforeBlockBraces: Description: >- Checks that the left block brace has or doesn't have space before it. @@ -1200,15 +1240,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 @@ -1288,20 +1329,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' @@ -1365,18 +1407,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 - AllowComments: false - VersionAdded: '0.9' - VersionChanged: '0.70' - Lint/HeredocMethodCallPosition: Description: >- Checks for the ordering of a method call where the receiver of the call is a HEREDOC. Enabled: false @@ -1442,14 +1476,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 @@ -1465,10 +1500,16 @@ Do not omit the accumulator when calling `next` in a `reduce`/`inject` block. Enabled: true VersionAdded: '0.36' +Lint/NonDeterministicRequireOrder: + Description: 'Always sort arrays returned by Dir.glob when requiring files.' + Enabled: true + VersionAdded: '0.78' + Safe: false + Lint/NonLocalExitFromIterator: Description: 'Do not use return in iterator to cause non-local exit.' Enabled: true VersionAdded: '0.30' @@ -1510,10 +1551,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' @@ -1555,12 +1626,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! @@ -1570,18 +1641,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' @@ -1615,16 +1686,17 @@ 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.' Enabled: true VersionAdded: '0.9' @@ -1643,34 +1715,10 @@ Lint/UnifiedInteger: 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' - VersionChanged: '0.74' - Lint/UnreachableCode: Description: 'Unreachable code.' Enabled: true VersionAdded: '0.9' @@ -1734,10 +1782,12 @@ Lint/UselessSetterCall: Description: 'Checks for useless setter call to a local variable.' Enabled: true VersionAdded: '0.13' + VersionChanged: '0.80' + Safe: false Lint/Void: Description: 'Possible use of operator/literal/variable in void context.' Enabled: true VersionAdded: '0.9' @@ -1796,33 +1846,10 @@ of test cases needed to validate a method. Enabled: true VersionAdded: '0.25' Max: 6 -Metrics/LineLength: - Description: 'Limit lines to 80 characters.' - StyleGuide: '#80-character-limits' - Enabled: true - VersionAdded: '0.25' - VersionChanged: '0.68' - AutoCorrect: false - Max: 80 - # To make it possible to copy or click on URIs in the code, we allow lines - # containing a URI to be longer than Max. - AllowHeredoc: true - AllowURI: true - URISchemes: - - http - - https - # The IgnoreCopDirectives option causes the LineLength rule to ignore cop - # directives like '# rubocop: enable ...' when calculating a line's length. - 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: [] - Metrics/MethodLength: Description: 'Avoid methods longer than 10 lines of code.' StyleGuide: '#short-methods' Enabled: true VersionAdded: '0.25' @@ -1858,11 +1885,11 @@ Migration/DepartmentName: Description: >- Check that cop names in rubocop:disable (etc) comments are given with department name. - Enabled: false + Enabled: true #################### Naming ############################## Naming/AccessorMethodName: Description: Check the naming of accessor methods for get_/set_. @@ -1880,10 +1907,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' @@ -1971,11 +2013,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. @@ -2003,29 +2045,55 @@ # - '\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 + - pp + # 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 @@ -2039,49 +2107,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' @@ -2329,29 +2358,17 @@ # collection.each { |element| puts element } # # # also good # collection.each do |element| puts element end AllowBracesOnProceduralOneLiners: false + # The BracesRequiredMethods overrides all other configurations except + # IgnoredMethods. It can be used to enforce that all blocks for specific + # methods use braces. For example, you can use this to enforce Sorbet + # signatures use braces even when the rest of your codebase enforces + # the `line_count_based` style. + BracesRequiredMethods: [] -Style/BracesAroundHashParameters: - Description: 'Enforce braces style around hash parameters.' - Enabled: true - VersionAdded: '0.14.1' - VersionChanged: '0.28' - EnforcedStyle: no_braces - SupportedStyles: - # The `braces` style enforces braces around all method parameters that are - # hashes. - - braces - # The `no_braces` style checks that the last parameter doesn't have braces - # around it. - - no_braces - # The `context_dependent` style checks that the last parameter doesn't have - # braces around it, but requires braces if the second to last parameter is - # also a hash literal. - - context_dependent - Style/CaseEquality: Description: 'Avoid explicit use of the case equality operator(===).' StyleGuide: '#no-case-equality' Enabled: true VersionAdded: '0.9' @@ -2365,11 +2382,11 @@ Style/ClassAndModuleChildren: Description: 'Checks style of children classes and modules.' 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 AutoCorrect: false Enabled: true @@ -2732,21 +2749,26 @@ 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.69' + VersionChanged: '0.79' EnforcedStyle: always SupportedStyles: # `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 + # `always_true` will add the frozen string literal comment to a file, + # similarly to the `always` style, but will also change any disabled + # comments (e.g. `# frozen_string_literal: false`) to be enabled. + - always_true # `never` will enforce that the frozen string literal comment does not # exist in a file. - never + Safe: false Style/GlobalVars: Description: 'Do not introduce global variables.' StyleGuide: '#instance-vars' Reference: 'https://www.zenspider.com/ruby/quickref.html' @@ -2763,10 +2785,17 @@ VersionChanged: '0.22' # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless` # needs to have to trigger this cop MinBodyLength: 1 +Style/HashEachMethods: + Description: 'Use Hash#each_key and Hash#each_value.' + StyleGuide: '#hash-each' + Enabled: pending + VersionAdded: '0.80' + Safe: false + Style/HashSyntax: Description: >- Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax { :a => 1, :b => 2 }. StyleGuide: '#hash-literals' @@ -2786,10 +2815,22 @@ # Force hashes that have a symbol value to use hash rockets UseHashRocketsWithSymbolValues: false # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style PreferHashRocketsForNonAlnumEndingSymbols: false +Style/HashTransformKeys: + Description: 'Prefer `transform_keys` over `each_with_object` and `map`.' + Enabled: 'pending' + VersionAdded: '0.80' + Safe: false + +Style/HashTransformValues: + Description: 'Prefer `transform_values` over `each_with_object` and `map`.' + Enabled: 'pending' + VersionAdded: '0.80' + Safe: false + Style/IdenticalConditionalBranches: Description: >- Checks that conditional statements do not have an identical line at the end of each branch, which can validly be moved out of the conditional. @@ -2872,12 +2913,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.' @@ -3146,12 +3188,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 @@ -3400,10 +3442,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' @@ -3418,15 +3470,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' @@ -3439,10 +3502,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' @@ -3496,15 +3566,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! @@ -3778,11 +3848,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 @@ -3799,11 +3869,11 @@ # on_exception :restart # # Commonly used in DSLs AllowDSLWriters: false IgnoreClassMethods: false - Whitelist: + AllowedMethods: - to_ary - to_a - to_c - to_enum - to_h @@ -3825,38 +3895,9 @@ Do not use unless with else. Rewrite these with the positive 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`.