Skip to content

Upgrade RuboCop to 1.62.1 and more rubocop extensions

What does this MR do and why?

Allow bundler to update patch releases to make the experiences of using gitlab-styles on projects more stable. We've seen breaking changes being introduced in minor releases before - not so much in patch releases.

Impact on gitlab-org/gitlab

Instead of reviewing changelog entries from all gems let's test the version on gitlab-org/gitlab to see the amount of changes.

See Draft: Upgrade gitlab-styles - dry-run (gitlab-org/gitlab!147655).

Offenses

$ be rubocop -f o

 34754/34754 files |==================================== 100 ====================================>| Time: 00:00:47

1106  Layout/LineEndStringConcatenationIndentation [Safe Correctable]
575   Performance/StringIdentifierArgument [Safe Correctable]
219   GraphQL/ExtractType
165   Lint/SymbolConversion [Safe Correctable]
139   RSpec/ExampleWording [Safe Correctable]
130   GraphQL/GraphqlName
75    Style/HashEachMethods [Unsafe Correctable]
42    Style/RedundantParentheses [Safe Correctable]
23    GraphQL/UnnecessaryFieldAlias [Safe Correctable]
22    Layout/ExtraSpacing [Safe Correctable]
5     Lint/RedundantSafeNavigation [Unsafe Correctable]
4     Rails/Pluck [Unsafe Correctable]
3     GraphQL/FieldDefinitions [Safe Correctable]
3     Lint/SelfAssignment
2     Style/RedundantReturn [Safe Correctable]
2     Style/SelfAssignment [Safe Correctable]
1     GraphQL/FieldMethod [Safe Correctable]
1     GraphQL/OrderedFields [Safe Correctable]
1     Performance/MapCompact [Unsafe Correctable]
1     Performance/StringInclude [Unsafe Correctable]
--
2519  Total in 1401 files

Config diff

Click to expand
--- before.txt	2024-04-08 10:15:20.655783283 +0200
+++ after.txt	2024-04-08 10:16:27.010680239 +0200
@@ -1,4 +1,4 @@
-# Available cops (1093) + config for /home/peter/devel/gitlab/gdk/gitlab: 
+# Available cops (1104) + config for /home/peter/devel/gitlab/gdk/gitlab: 
 # Department 'API' (3):
 # Supports --autocorrect
 API/Base:
@@ -121,15 +121,16 @@
   - "**/Gemfile"
   - "**/gems.rb"
 
-# Department 'Capybara' (9):
+# Department 'Capybara' (10):
 Capybara/ClickLinkOrButtonStyle:
-  Description: Checks for click button or link style.
+  Description: Checks for methods of button or link clicks.
   Enabled: pending
   VersionAdded: '2.19'
-  EnforcedStyle: strict
+  VersionChanged: '2.20'
+  EnforcedStyle: link_or_button
   SupportedStyles:
-  - strict
   - link_or_button
+  - strict
   Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/ClickLinkOrButtonStyle
 
 # Supports --autocorrect
@@ -152,12 +153,20 @@
   Description: Enforces use of `have_no_*` or `not_to` for negated expectations.
   Enabled: pending
   VersionAdded: '2.14'
-  EnforcedStyle: not_to
+  VersionChanged: '2.20'
+  EnforcedStyle: have_no
   SupportedStyles:
   - have_no
   - not_to
   Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/NegationMatcher
 
+# Supports --autocorrect
+Capybara/RedundantWithinFind:
+  Description: Checks for redundant `within find(...)` calls.
+  Enabled: pending
+  VersionAdded: '2.20'
+  Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/RedundantWithinFind
+
 Capybara/SpecificActions:
   Description: Checks for there is a more specific actions offered by Capybara.
   Enabled: pending
@@ -504,14 +513,14 @@
 Database/RescueStatementTimeout:
   Enabled: true
 
-# Department 'FactoryBot' (10):
+# Department 'FactoryBot' (11):
 # Supports --autocorrect
 FactoryBot/AssociationStyle:
   Description: Use a consistent style to define associations.
   Enabled: pending
   Safe: false
   VersionAdded: '2.23'
-  VersionChanged: "<<next>>"
+  VersionChanged: '2.24'
   EnforcedStyle: implicit
   SupportedStyles:
   - explicit
@@ -524,7 +533,7 @@
   Description: Always declare attribute values as blocks.
   Enabled: true
   VersionAdded: '1.28'
-  VersionChanged: "<<next>>"
+  VersionChanged: '2.24'
   Reference: https://www.rubydoc.info/gems/rubocop-factory_bot/RuboCop/Cop/FactoryBot/AttributeDefinedStatically
 
 # Supports --autocorrect
@@ -561,9 +570,21 @@
   ExplicitOnly: false
   SafeAutoCorrect: false
   VersionAdded: '1.25'
-  VersionChanged: "<<next>>"
+  VersionChanged: '2.24'
   Reference: https://www.rubydoc.info/gems/rubocop-factory_bot/RuboCop/Cop/FactoryBot/CreateList
 
+FactoryBot/ExcessiveCreateList:
+  Description: Check for excessive model creation in a list.
+  Enabled: true
+  Include:
+  - "**/*_spec.rb"
+  - "**/spec/**/*"
+  - "**/test/**/*"
+  - "**/features/support/factories/**/*.rb"
+  MaxAmount: 10
+  VersionAdded: '2.25'
+  Reference: https://www.rubydoc.info/gems/rubocop-factory_bot/RuboCop/Cop/FactoryBot/ExcessiveCreateList
+
 FactoryBot/FactoryAssociationWithStrategy:
   Description: Use definition in factory association instead of hard coding a strategy.
   Enabled: pending
@@ -581,7 +602,7 @@
   Description: Use string value when setting the class attribute explicitly.
   Enabled: true
   VersionAdded: '1.37'
-  VersionChanged: "<<next>>"
+  VersionChanged: '2.24'
   Reference: https://www.rubydoc.info/gems/rubocop-factory_bot/RuboCop/Cop/FactoryBot/FactoryClassName
 
 # Supports --autocorrect
@@ -606,7 +627,7 @@
 FactoryBot/IdSequence:
   Description: Do not create a FactoryBot sequence for an id column.
   Enabled: pending
-  VersionAdded: "<<next>>"
+  VersionAdded: '2.24'
   Reference: https://www.rubydoc.info/gems/rubocop-factory_bot/RuboCop/Cop/FactoryBot/IdSequence
 
 # Supports --autocorrect
@@ -937,11 +958,6 @@
   - ee/spec/features/registrations/saas/**/*
   - ee/spec/features/trials/saas/**/*
 
-# Department 'Gitlab/Rails' (1):
-# Supports --autocorrect
-Gitlab/Rails/SafeFormat:
-  Enabled: true
-
 # Department 'GitlabSecurity' (7):
 GitlabSecurity/DeepMunge:
   Description: Checks for disabling the deep munge security control.
@@ -1002,25 +1018,25 @@
   - "/home/peter/devel/gitlab/gdk/gitlab/lib/**/*.rake"
   - "/home/peter/devel/gitlab/gdk/gitlab/spec/**/*"
 
-# Department 'GraphQL' (21):
+# Department 'GraphQL' (26):
 GraphQL/ArgumentDescription:
   Enabled: false
-  VersionAdded: '0.80'
+  VersionAdded: 0.2.0
   Description: Ensures all arguments have a description
 
 GraphQL/ArgumentName:
   Enabled: true
-  VersionAdded: '0.80'
+  VersionAdded: 0.2.0
   Description: This cop checks whether argument names are snake_case
 
 GraphQL/ArgumentUniqueness:
   Enabled: true
-  VersionAdded: '0.80'
+  VersionAdded: 0.11.0
   Description: This cop enforces arguments to be defined once per block
 
 GraphQL/ExtractInputType:
   Enabled: false
-  VersionAdded: '0.80'
+  VersionAdded: 0.2.0
   Description: Suggests using input type instead of many arguments
   MaxArguments: 2
   Include:
@@ -1028,7 +1044,7 @@
 
 GraphQL/ExtractType:
   Enabled: false
-  VersionAdded: '0.80'
+  VersionAdded: 0.2.0
   Description: Suggests extracting fields with common prefixes to the separate type
   MaxFields: 2
   Prefixes:
@@ -1042,7 +1058,7 @@
 # Supports --autocorrect
 GraphQL/FieldDefinitions:
   Enabled: true
-  VersionAdded: '0.80'
+  VersionAdded: 0.1.0
   Description: Checks consistency of field definitions
   EnforcedStyle: group_definitions
   SupportedStyles:
@@ -1051,48 +1067,86 @@
 
 GraphQL/FieldDescription:
   Enabled: false
-  VersionAdded: '0.80'
+  VersionAdded: 0.1.0
   Description: Ensures all fields have a description
 
 # Supports --autocorrect
 GraphQL/FieldHashKey:
   Enabled: true
-  VersionAdded: '0.80'
+  VersionAdded: 0.4.0
   Description: Checks :hash_key option is used for appropriate fields
 
 # Supports --autocorrect
 GraphQL/FieldMethod:
   Enabled: true
-  VersionAdded: '0.80'
+  VersionAdded: 0.2.0
   Description: Checks :method option is used for appropriate fields
 
 # Supports --autocorrect
 GraphQL/FieldName:
   Enabled: true
-  VersionAdded: '0.80'
+  VersionAdded: 0.2.0
   Description: This cop checks whether field names are snake_case
   SafeAutoCorrect: false
 
 GraphQL/FieldUniqueness:
   Enabled: true
-  VersionAdded: '0.80'
+  VersionAdded: 0.11.0
   Description: This cop enforces fields to be defined once
 
+GraphQL/GraphqlName:
+  Enabled: true
+  VersionAdded: 1.0.0
+  Description: This cop check proper configuration of graphql_name
+  Include:
+  - "**/graphql/types/**/*"
+  - "**/graphql/mutations/**/*"
+  EnforcedStyle: only_override
+  SupportedStyles:
+  - required
+  - only_override
+
 GraphQL/LegacyDsl:
   Enabled: false
-  VersionAdded: '0.80'
+  VersionAdded: 0.9.0
   Description: Checks that types are defined with class-based API
 
+GraphQL/MaxComplexitySchema:
+  Enabled: true
+  VersionAdded: 1.0.0
+  Description: Enforces max_complexity configuration in schema
+  Include:
+  - "**/graphql/**/*_schema.rb"
+
+GraphQL/MaxDepthSchema:
+  Enabled: true
+  VersionAdded: 1.0.0
+  Description: Enforces max_depth configuration in schema
+  Include:
+  - "**/graphql/**/*_schema.rb"
+
 # Supports --autocorrect
 GraphQL/MultipleFieldDefinitions:
   Enabled: true
+  VersionAdded: 0.15.0
   Description: Ensures that fields with multiple definitions are grouped together
 
+GraphQL/NotAuthorizedNodeType:
+  Enabled: true
+  VersionAdded: 1.0.0
+  Description: Detects types that implement Node interface and not have `.authorized?`
+    check
+  Include:
+  - "**/graphql/types/**/*"
+  SafeBaseClasses: []
+
 GraphQL/ObjectDescription:
   Enabled: false
-  VersionAdded: '0.80'
+  VersionAdded: 0.3.0
   Description: Ensures all types have a description
   Exclude:
+  - "/home/peter/devel/gitlab/gdk/gitlab/spec/**/*"
+  - "/home/peter/devel/gitlab/gdk/gitlab/test/**/*"
   - "/home/peter/devel/gitlab/gdk/gitlab/**/*_schema.rb"
   - "/home/peter/devel/gitlab/gdk/gitlab/**/base_*.rb"
   - "/home/peter/devel/gitlab/gdk/gitlab/**/graphql/query_context.rb"
@@ -1100,38 +1154,51 @@
 # Supports --autocorrect
 GraphQL/OrderedArguments:
   Enabled: true
-  VersionAdded: '0.80'
+  VersionAdded: 0.7.0
   Description: Arguments should be alphabetically sorted within groups
+  Order:
 
 # Supports --autocorrect
 GraphQL/OrderedFields:
   Enabled: true
-  VersionAdded: '0.80'
+  VersionAdded: 0.5.0
   Description: Fields should be alphabetically sorted within groups
+  Groups: true
+  Order:
+
+# Supports --autocorrect
+GraphQL/PrepareMethod:
+  Enabled: true
 
 GraphQL/ResolverMethodLength:
   Enabled: true
-  VersionAdded: '0.80'
+  VersionAdded: 0.1.0
   Description: Checks resolver methods are not too long
   Max: 10
   CountComments: false
   ExcludedMethods: []
+  CountAsOne: []
 
 GraphQL/UnnecessaryArgumentCamelize:
   Enabled: true
+  VersionAdded: 0.18.0
   Description: Camelize isn't necessary if the argument name doesn't contain underscores
 
+# Supports --autocorrect
 GraphQL/UnnecessaryFieldAlias:
   Enabled: true
+  VersionAdded: 0.18.0
   Description: Field aliases should be different than their field names
 
 GraphQL/UnnecessaryFieldCamelize:
   Enabled: true
+  VersionAdded: 0.18.0
   Description: Camelize isn't necessary if the field name doesn't contain underscores
 
 # Supports --autocorrect
 GraphQL/UnusedArgument:
   Enabled: true
+  VersionAdded: 0.12.0
   Description: Arguments should either be listed explicitly or **rest should be in the
     resolve signature
 
@@ -1393,7 +1460,9 @@
 Layout/EmptyComment:
   Description: Checks empty comment.
   Enabled: true
+  AutoCorrect: contextual
   VersionAdded: '0.53'
+  VersionChanged: '1.61'
   AllowBorderComment: true
   AllowMarginComment: true
 
@@ -1774,7 +1843,7 @@
     string literal and a backslash.
   Enabled: true
   VersionAdded: '1.18'
-  EnforcedStyle: aligned
+  EnforcedStyle: indented
   SupportedStyles:
   - aligned
   - indented
@@ -2044,6 +2113,10 @@
   SupportedStylesForExponentOperator:
   - space
   - no_space
+  EnforcedStyleForRationalLiterals: no_space
+  SupportedStylesForRationalLiterals:
+  - space
+  - no_space
 
 # Supports --autocorrect
 Layout/SpaceBeforeBlockBraces:
@@ -2229,7 +2302,7 @@
   VersionChanged: '1.0'
   AllowInHeredoc: false
 
-# Department 'Lint' (135):
+# Department 'Lint' (137):
 Lint/AmbiguousAssignment:
   Description: Checks for mistyped shorthand assignments.
   Enabled: true
@@ -2519,17 +2592,19 @@
   Description: Checks for the presence of `if`, `elsif` and `unless` branches without
     a body.
   Enabled: true
+  AutoCorrect: contextual
   SafeAutoCorrect: false
   AllowComments: true
   VersionAdded: '0.89'
-  VersionChanged: '1.34'
+  VersionChanged: '1.61'
 
 # Supports --autocorrect
 Lint/EmptyEnsure:
   Description: Checks for empty ensure block.
   Enabled: true
+  AutoCorrect: contextual
   VersionAdded: '0.10'
-  VersionChanged: '0.48'
+  VersionChanged: '1.61'
 
 Lint/EmptyExpression:
   Description: Checks for empty expressions.
@@ -2556,8 +2631,9 @@
 Lint/EmptyInterpolation:
   Description: Checks for empty string interpolation.
   Enabled: true
+  AutoCorrect: contextual
   VersionAdded: '0.20'
-  VersionChanged: '0.45'
+  VersionChanged: '1.61'
 
 Lint/EmptyWhen:
   Description: Checks for `when` branches with empty bodies.
@@ -2664,6 +2740,12 @@
   VersionAdded: '0.50'
   VersionChanged: '1.40'
 
+Lint/ItWithoutArgumentsInBlock:
+  Description: Checks uses of `it` calls without arguments in block.
+  Reference: https://bugs.ruby-lang.org/issues/18980
+  Enabled: pending
+  VersionAdded: '1.59'
+
 # Supports --autocorrect
 Lint/LambdaWithoutLiteralBlock:
   Description: Checks uses of lambda without a literal block.
@@ -2675,6 +2757,11 @@
   Enabled: true
   VersionAdded: '0.51'
 
+Lint/LiteralAssignmentInCondition:
+  Description: Checks for literal assignments in the conditions.
+  Enabled: pending
+  VersionAdded: '1.58'
+
 # Supports --autocorrect
 Lint/LiteralInInterpolation:
   Description: Checks for literals used in interpolation.
@@ -3120,7 +3207,9 @@
 Lint/TrailingCommaInAttributeDeclaration:
   Description: Checks for trailing commas in attribute declarations.
   Enabled: true
+  AutoCorrect: contextual
   VersionAdded: '0.90'
+  VersionChanged: '1.61'
 
 # Supports --autocorrect
 Lint/TripleQuotes:
@@ -3182,8 +3271,9 @@
   Description: Checks for unused block arguments.
   StyleGuide: "#underscore-unused-vars"
   Enabled: true
+  AutoCorrect: contextual
   VersionAdded: '0.21'
-  VersionChanged: '0.22'
+  VersionChanged: '1.61'
   IgnoreEmptyBlocks: true
   AllowUnusedKeywordArguments: false
 
@@ -3192,8 +3282,9 @@
   Description: Checks for unused method arguments.
   StyleGuide: "#underscore-unused-vars"
   Enabled: true
+  AutoCorrect: contextual
   VersionAdded: '0.21'
-  VersionChanged: '0.81'
+  VersionChanged: '1.61'
   AllowUnusedKeywordArguments: false
   IgnoreEmptyMethods: true
   IgnoreNotImplementedMethods: true
@@ -3217,8 +3308,9 @@
 Lint/UselessAccessModifier:
   Description: Checks for useless access modifiers.
   Enabled: true
+  AutoCorrect: contextual
   VersionAdded: '0.20'
-  VersionChanged: '0.83'
+  VersionChanged: '1.61'
   ContextCreatingMethods:
   - class_methods
   MethodCreatingMethods: []
@@ -3228,8 +3320,9 @@
   Description: Checks for useless assignment to a local variable.
   StyleGuide: "#underscore-unused-vars"
   Enabled: true
+  AutoCorrect: contextual
   VersionAdded: '0.11'
-  VersionChanged: '1.51'
+  VersionChanged: '1.61'
   SafeAutoCorrect: false
 
 Lint/UselessElseWithoutRescue:
@@ -3242,8 +3335,9 @@
 Lint/UselessMethodDefinition:
   Description: Checks for useless method definitions.
   Enabled: true
+  AutoCorrect: contextual
   VersionAdded: '0.90'
-  VersionChanged: '0.91'
+  VersionChanged: '1.61'
   Safe: false
 
 Lint/UselessRescue:
@@ -3268,14 +3362,18 @@
 Lint/UselessTimes:
   Description: Checks for useless `Integer#times` calls.
   Enabled: true
-  VersionAdded: '0.91'
   Safe: false
+  AutoCorrect: contextual
+  VersionAdded: '0.91'
+  VersionChanged: '1.61'
 
 # Supports --autocorrect
 Lint/Void:
   Description: Possible use of operator/literal/variable in void context.
   Enabled: true
+  AutoCorrect: contextual
   VersionAdded: '0.9'
+  VersionChanged: '1.61'
   CheckForMethodsWithNoSideEffects: false
 
 # Department 'Metrics' (10):
@@ -3388,7 +3486,7 @@
   AllowedPatterns: []
   Max: 14
 
-# Department 'Migration' (42):
+# Department 'Migration' (40):
 Migration/AddColumnsToWideTables:
   Enabled: true
 
@@ -3439,9 +3537,6 @@
   - db/migrate/*.rb
   - db/post_migrate/*.rb
 
-Migration/ChangeColumnNullOnHighTrafficTable:
-  Enabled: true
-
 Migration/ComplexIndexesRequireName:
   Exclude:
   - !ruby/regexp /\Adb\/(post_)?migrate\/201.*\.rb\z/
@@ -3464,11 +3559,6 @@
 Migration/DropTable:
   Enabled: true
 
-Migration/EnsureFactoryForTable:
-  Enabled: true
-  Include:
-  - db/migrate/*.rb
-
 Migration/MigrationRecord:
   Enabled: true
 
@@ -3991,7 +4081,7 @@
 # Supports --autocorrect
 Performance/AncestorsInclude:
   Description: Use `A <= B` instead of `A.ancestors.include?(B)`.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#ancestorsinclude-vs--code
+  Reference: https://github.com/fastruby/fast-ruby#ancestorsinclude-vs--code
   Enabled: true
   Safe: false
   VersionAdded: '1.7'
@@ -4042,7 +4132,7 @@
 Performance/Casecmp:
   Description: Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`,
     or `== upcase`..
-  Reference: https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code
+  Reference: https://github.com/fastruby/fast-ruby#stringcasecmp-vs--stringcasecmp-vs-stringdowncase---code
   Enabled: true
   Safe: false
   VersionAdded: '0.36'
@@ -4115,7 +4205,7 @@
 Performance/Detect:
   Description: Use `detect` instead of `select.first`, `find_all.first`, `filter.first`,
     `select.last`, `find_all.last`, and `filter.last`.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code
+  Reference: https://github.com/fastruby/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code
   SafeAutoCorrect: false
   Enabled: true
   VersionAdded: '0.30'
@@ -4133,7 +4223,7 @@
 # Supports --autocorrect
 Performance/EndWith:
   Description: Use `end_with?` instead of a regex match anchored to the end of a string.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end
+  Reference: https://github.com/fastruby/fast-ruby#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
   SafeAutoCorrect: false
   Enabled: true
   SafeMultiline: true
@@ -4149,7 +4239,7 @@
 Performance/FlatMap:
   Description: Use `Enumerable#flat_map` instead of `Enumerable#map...Array#flatten(1)`
     or `Enumerable#collect..Array#flatten(1)`.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code
+  Reference: https://github.com/fastruby/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code
   Enabled: true
   VersionAdded: '0.30'
   EnabledForFlattenWithoutParams: true
@@ -4157,7 +4247,7 @@
 # Supports --autocorrect
 Performance/InefficientHashSearch:
   Description: Use `key?` or `value?` instead of `keys.include?` or `values.include?`.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#hashkey-instead-of-hashkeysinclude-code
+  Reference: https://github.com/fastruby/fast-ruby#hashkey-instead-of-hashkeysinclude-code
   Enabled: true
   VersionAdded: '0.56'
   Safe: false
@@ -4184,7 +4274,7 @@
 
 Performance/MethodObjectAsBlock:
   Description: Use block explicitly instead of block-passing a method object.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#normal-way-to-apply-method-vs-method-code
+  Reference: https://github.com/fastruby/fast-ruby#normal-way-to-apply-method-vs-method-code
   Enabled: true
   VersionAdded: '1.9'
 
@@ -4197,7 +4287,7 @@
 # Supports --autocorrect
 Performance/RangeInclude:
   Description: Use `Range#cover?` instead of `Range#include?` (or `Range#member?`).
-  Reference: https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code
+  Reference: https://github.com/fastruby/fast-ruby#cover-vs-include-code
   Enabled: true
   VersionAdded: '0.36'
   VersionChanged: '1.7'
@@ -4210,7 +4300,7 @@
 # Supports --autocorrect
 Performance/RedundantBlockCall:
   Description: Use `yield` instead of `block.call`.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode
+  Reference: https://github.com/fastruby/fast-ruby#proccall-and-block-arguments-vs-yieldcode
   Enabled: true
   VersionAdded: '0.36'
 
@@ -4234,7 +4324,7 @@
 # Supports --autocorrect
 Performance/RedundantMerge:
   Description: Use Hash#[]=, rather than Hash#merge! with a single key-value pair.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code
+  Reference: https://github.com/fastruby/fast-ruby#hashmerge-vs-hash-code
   Enabled: true
   Safe: false
   VersionAdded: '0.36'
@@ -4264,14 +4354,14 @@
 Performance/RegexpMatch:
   Description: Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
     `Regexp#===`, or `=~` when `MatchData` is not used.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code-
+  Reference: https://github.com/fastruby/fast-ruby#regexp-vs-regexpmatch-vs-regexpmatch-vs-stringmatch-vs-string-vs-stringmatch-code-
   Enabled: true
   VersionAdded: '0.47'
 
 # Supports --autocorrect
 Performance/ReverseEach:
   Description: Use `reverse_each` instead of `reverse.each`.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code
+  Reference: https://github.com/fastruby/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code
   Enabled: true
   VersionAdded: '0.30'
 
@@ -4295,7 +4385,7 @@
 Performance/Size:
   Description: Use `size` instead of `count` for counting the number of elements in
     `Array` and `Hash`.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code
+  Reference: https://github.com/fastruby/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code
   Enabled: true
   VersionAdded: '0.30'
 
@@ -4308,7 +4398,7 @@
 # Supports --autocorrect
 Performance/Squeeze:
   Description: Use `squeeze('a')` instead of `gsub(/a+/, 'a')`.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#remove-extra-spaces-or-other-contiguous-characters-code
+  Reference: https://github.com/fastruby/fast-ruby#remove-extra-spaces-or-other-contiguous-characters-code
   Enabled: true
   VersionAdded: '1.7'
 
@@ -4316,7 +4406,7 @@
 Performance/StartWith:
   Description: Use `start_with?` instead of a regex match anchored to the beginning
     of a string.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end
+  Reference: https://github.com/fastruby/fast-ruby#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
   SafeAutoCorrect: false
   Enabled: true
   SafeMultiline: true
@@ -4341,7 +4431,7 @@
 Performance/StringReplacement:
   Description: Use `tr` instead of `gsub` when you are replacing the same number of
     characters. Use `delete` instead of `gsub` when you are deleting characters.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code
+  Reference: https://github.com/fastruby/fast-ruby#stringgsub-vs-stringtr-code
   Enabled: true
   VersionAdded: '0.33'
 
@@ -4395,7 +4485,7 @@
   Exclude:
   - "/home/peter/devel/gitlab/gdk/gitlab/spec/rubocop/**/*_spec.rb"
 
-# Department 'RSpec' (131):
+# Department 'RSpec' (135):
 # Supports --autocorrect
 RSpec/AlignLeftLetBrace:
   Description: Checks that left braces for adjacent single line lets are aligned.
@@ -4503,7 +4593,7 @@
   - ee/spec/support/controllers/**/*
 
 RSpec/BeforeAfterAll:
-  Description: Check that before/after(:all) isn't being used.
+  Description: Check that before/after(:all/:context) isn't being used.
   Enabled: false
   Exclude:
   - "**/spec/spec_helper.rb"
@@ -4638,9 +4728,10 @@
   SupportedStyles:
   - described_class
   - explicit
+  OnlyStaticConstants: true
   SafeAutoCorrect: false
   VersionAdded: '1.0'
-  VersionChanged: '1.11'
+  VersionChanged: '2.27'
   Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
 
 RSpec/DescribedClassModuleWrapping:
@@ -5009,6 +5100,14 @@
   Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
 
 # Supports --autocorrect
+RSpec/IsExpectedSpecify:
+  Description: Check for `specify` with `is_expected` and one-liner expectations.
+  Enabled: pending
+  VersionAdded: '2.27'
+  StyleGuide: https://rspec.rubystyle.guide/#it-and-specify
+  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IsExpectedSpecify
+
+# Supports --autocorrect
 RSpec/ItBehavesLike:
   Description: Checks that only one `it_behaves_like` style is used.
   Enabled: true
@@ -5251,6 +5350,19 @@
   VersionAdded: '2.19'
   Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantAround
 
+# Supports --autocorrect
+RSpec/RedundantPredicateMatcher:
+  Description: Checks for redundant predicate matcher.
+  Enabled: pending
+  VersionAdded: '2.26'
+  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantPredicateMatcher
+
+RSpec/RemoveConst:
+  Description: Checks that `remove_const` is not used in specs.
+  Enabled: pending
+  VersionAdded: '2.26'
+  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RemoveConst
+
 RSpec/RepeatedDescription:
   Description: Check for repeated description strings in example groups.
   Enabled: false
@@ -5281,6 +5393,12 @@
   VersionAdded: '1.44'
   Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedIncludeExample
 
+RSpec/RepeatedSubjectCall:
+  Description: Checks for repeated calls to subject missing that it is memoized.
+  Enabled: pending
+  VersionAdded: '2.27'
+  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedSubjectCall
+
 # Supports --autocorrect
 RSpec/ReturnFromStub:
   Description: Checks for consistent style of stub's return setting.
@@ -5317,9 +5435,14 @@
 
 # Supports --autocorrect
 RSpec/SharedExamples:
-  Description: Enforces use of string to titleize shared examples.
+  Description: Checks for consistent style for shared example names.
   Enabled: true
+  EnforcedStyle: string
+  SupportedStyles:
+  - string
+  - symbol
   VersionAdded: '1.25'
+  VersionChanged: '2.26'
   Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
 
 RSpec/SharedGroupsMetadata:
@@ -5501,7 +5624,7 @@
   VersionChanged: '2.0'
   Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
 
-# Department 'RSpec/FactoryBot' (5):
+# Department 'RSpec/FactoryBot' (4):
 RSpec/FactoryBot/AvoidCreate:
   Enabled: true
   Include:
@@ -5522,10 +5645,6 @@
   - ee/spec/routes/directs/*.rb
   - ee/spec/lib/sidebars/**/*.rb
 
-RSpec/FactoryBot/ExcessiveCreateList:
-  Enabled: true
-  MaxAmount: 10
-
 # Supports --autocorrect
 RSpec/FactoryBot/InlineAssociation:
   Include:
@@ -5557,8 +5676,12 @@
 RSpec/Rails/HaveHttpStatus:
   Description: Checks that tests use `have_http_status` instead of equality matchers.
   Enabled: pending
+  ResponseMethods:
+  - response
+  - last_response
   SafeAutoCorrect: false
   VersionAdded: '2.12'
+  VersionChanged: '2.27'
   Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus
 
 # Supports --autocorrect
@@ -5600,7 +5723,7 @@
 
 # Supports --autocorrect
 RSpec/Rails/MinitestAssertions:
-  Description: Check if using Minitest matchers.
+  Description: Check if using Minitest-like matchers.
   Enabled: pending
   VersionAdded: '2.17'
   Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/MinitestAssertions
@@ -5717,6 +5840,7 @@
   - https://guides.rubyonrails.org/engines.html#available-load-hooks
   SafeAutoCorrect: false
   VersionAdded: '2.16'
+  VersionChanged: '2.24'
 
 # Supports --autocorrect
 Rails/AddColumnIndex:
@@ -6006,9 +6130,10 @@
   Description: Do not access `ENV` directly after initialization.
   Enabled: false
   VersionAdded: '2.10'
-  VersionChanged: '2.11'
+  VersionChanged: '2.24'
   Include:
   - app/**/*.rb
+  - config/initializers/**/*.rb
   - lib/**/*.rb
   Exclude:
   - "/home/peter/devel/gitlab/gdk/gitlab/lib/**/*.rake"
@@ -6531,7 +6656,7 @@
 
 # Supports --autocorrect
 Rails/ResponseParsedBody:
-  Description: Prefer `response.parsed_body` to `JSON.parse(response.body)`.
+  Description: Prefer `response.parsed_body` to custom parsing logic for `response.body`.
   Enabled: pending
   Safe: false
   VersionAdded: '2.18'
@@ -7000,7 +7125,7 @@
   - app/workers/**/*
   - ee/app/workers/**/*
 
-# Department 'Style' (261):
+# Department 'Style' (263):
 # Supports --autocorrect
 Style/AccessModifierDeclarations:
   Description: Checks style of how access modifiers are used.
@@ -7056,7 +7181,19 @@
   Enabled: true
   AllowOnlyRestArgument: true
   UseAnonymousForwarding: false
+  RedundantRestArgumentNames:
+  - args
+  - arguments
+  RedundantKeywordRestArgumentNames:
+  - kwargs
+  - options
+  - opts
+  RedundantBlockArgumentNames:
+  - blk
+  - block
+  - proc
   VersionAdded: '1.1'
+  VersionChanged: '1.58'
 
 # Supports --autocorrect
 Style/ArrayCoercion:
@@ -7068,6 +7205,14 @@
   VersionAdded: '0.88'
 
 # Supports --autocorrect
+Style/ArrayFirstLast:
+  Description: Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.
+  Reference: "#first-and-last"
+  Enabled: false
+  VersionAdded: '1.58'
+  Safe: false
+
+# Supports --autocorrect
 Style/ArrayIntersect:
   Description: Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.
   Enabled: pending
@@ -7525,8 +7670,9 @@
 Style/EmptyElse:
   Description: Avoid empty else-clauses.
   Enabled: true
+  AutoCorrect: contextual
   VersionAdded: '0.28'
-  VersionChanged: '0.32'
+  VersionChanged: '1.61'
   EnforcedStyle: both
   SupportedStyles:
   - empty
@@ -7538,7 +7684,9 @@
 Style/EmptyHeredoc:
   Description: Checks for using empty heredoc to reduce redundancy.
   Enabled: pending
+  AutoCorrect: contextual
   VersionAdded: '1.32'
+  VersionChanged: '1.61'
 
 # Supports --autocorrect
 Style/EmptyLambdaParameter:
@@ -7559,7 +7707,9 @@
   Description: Checks the formatting of empty method definitions.
   StyleGuide: "#no-single-line-methods"
   Enabled: true
+  AutoCorrect: contextual
   VersionAdded: '0.46'
+  VersionChanged: '1.61'
   EnforcedStyle: compact
   SupportedStyles:
   - compact
@@ -8523,6 +8673,7 @@
 
 Style/OptionHash:
   Description: Don't use option hashes when you can use keyword arguments.
+  StyleGuide: "#keyword-arguments-vs-option-hashes"
   Enabled: false
   VersionAdded: '0.33'
   VersionChanged: '0.34'
@@ -8646,8 +8797,9 @@
   Description: Checks the arguments passed to raise/fail.
   StyleGuide: "#exception-class-messages"
   Enabled: true
+  Safe: false
   VersionAdded: '0.14'
-  VersionChanged: '1.2'
+  VersionChanged: '1.61'
   EnforcedStyle: exploded
   SupportedStyles:
   - compact
@@ -8754,7 +8906,7 @@
   Description: Use `fetch(key, value)` instead of `fetch(key) { value }` when value
     has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or
     is a constant.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code
+  Reference: https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code
   Enabled: true
   Safe: false
   SafeForConstants: false
@@ -8795,10 +8947,11 @@
 Style/RedundantInitialize:
   Description: Checks for redundant `initialize` methods.
   Enabled: pending
+  AutoCorrect: contextual
   Safe: false
   AllowComments: true
   VersionAdded: '1.27'
-  VersionChanged: '1.28'
+  VersionChanged: '1.61'
 
 # Supports --autocorrect
 Style/RedundantInterpolation:
@@ -8995,7 +9148,7 @@
 # Supports --autocorrect
 Style/Sample:
   Description: Use `sample` instead of `shuffle.first`, `shuffle.last`, and `shuffle[Integer]`.
-  Reference: https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code
+  Reference: https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code
   Enabled: true
   VersionAdded: '0.30'
 
@@ -9070,6 +9223,7 @@
 # Supports --autocorrect
 Style/SingleLineDoEndBlock:
   Description: Checks for single-line `do`...`end` blocks.
+  StyleGuide: "#single-line-do-end-block"
   Enabled: pending
   VersionAdded: '1.57'
 
@@ -9084,7 +9238,9 @@
 
 # Supports --autocorrect
 Style/SlicingWithRange:
-  Description: Checks array slicing is done with endless ranges when suitable.
+  Description: Checks array slicing is done with redundant, endless, and beginless ranges
+    when suitable.
+  StyleGuide: "#slicing-with-ranges"
   Enabled: true
   VersionAdded: '0.83'
   Safe: false
@@ -9217,6 +9373,13 @@
   VersionChanged: '1.20'
 
 # Supports --autocorrect
+Style/SuperWithArgsParentheses:
+  Description: Use parentheses for `super` with arguments.
+  StyleGuide: "#super-with-args"
+  Enabled: pending
+  VersionAdded: '1.58'
+
+# Supports --autocorrect
 Style/SwapValues:
   Description: Enforces the use of shorthand-style swapping of 2 variables.
   StyleGuide: "#values-swapping"
Edited by Peter Leitzen

Merge request reports

Loading