From cea5a3a34f66bd16674216ee1abae4c1e521a8c3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:30:21 +0000 Subject: [PATCH 1/6] Bump rubocop from 1.63.4 to 1.71.0 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.63.4 to 1.71.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.63.4...v1.71.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 55e64bcd..2d8623ee 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,12 +12,12 @@ GEM byebug (11.1.3) coderay (1.1.3) diffy (3.4.3) - json (2.7.2) + json (2.9.1) language_server-protocol (3.17.0.3) method_source (1.0.0) minitest (5.25.4) - parallel (1.24.0) - parser (3.3.1.0) + parallel (1.26.3) + parser (3.3.7.0) ast (~> 2.4.1) racc pry (0.14.2) @@ -26,26 +26,26 @@ GEM pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) - racc (1.7.3) + racc (1.8.1) rainbow (3.1.1) rake (13.2.1) - regexp_parser (2.9.0) - rexml (3.2.6) - rubocop (1.63.4) + regexp_parser (2.10.0) + rubocop (1.71.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.37.0) parser (>= 3.3.1.0) ruby-progressbar (1.13.0) - unicode-display_width (2.5.0) + unicode-display_width (3.1.4) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) PLATFORMS ruby From e7fb6698351e0d0178debbdb93cafd1ef3830053 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:30:57 +0000 Subject: [PATCH 2/6] Dump full RuboCop config This automated commit dumps the contents of the full RuboCop config. [dependabot skip] --- test/fixtures/full_config.yml | 164 +++++++++++++++++++++++++++++++--- 1 file changed, 150 insertions(+), 14 deletions(-) diff --git a/test/fixtures/full_config.yml b/test/fixtures/full_config.yml index fef84296..eb3cef69 100644 --- a/test/fixtures/full_config.yml +++ b/test/fixtures/full_config.yml @@ -70,6 +70,7 @@ AllCops: DisplayStyleGuide: false StyleGuideBaseURL: https://shopify.github.io/ruby-style-guide/ DocumentationBaseURL: https://docs.rubocop.org/rubocop + DocumentationExtension: ".html" ExtraDetails: false StyleGuideCopsOnly: false EnabledByDefault: false @@ -86,6 +87,7 @@ AllCops: - rails rubocop-rspec: - rspec + - rspec-rails rubocop-minitest: - minitest rubocop-sequel: @@ -102,6 +104,7 @@ AllCops: rubocop-rspec_rails: - rspec-rails ActiveSupportExtensionsEnabled: false + StringLiteralsFrozenByDefault: Bundler/DuplicatedGem: Description: Checks for duplicate gem entries in Gemfile. Enabled: true @@ -182,6 +185,14 @@ Bundler/OrderedGems: - "**/*.gemfile" - "**/Gemfile" - "**/gems.rb" +Gemspec/AddRuntimeDependency: + Description: Prefer `add_dependency` over `add_runtime_dependency`. + StyleGuide: "#add_dependency_vs_add_runtime_dependency" + Reference: https://github.com/rubygems/rubygems/issues/7799#issuecomment-2192720316 + Enabled: pending + VersionAdded: '1.65' + Include: + - "**/*.gemspec" Gemspec/DependencyVersion: Description: Requires or forbids specifying gem dependency versions. Enabled: false @@ -593,6 +604,7 @@ Layout/FirstMethodArgumentLineBreak: Enabled: true VersionAdded: '0.49' AllowMultilineFinalElement: true + AllowedMethods: [] Layout/FirstMethodParameterLineBreak: Description: Checks for a line break before the first parameter in a multi-line method parameter definition. @@ -685,6 +697,8 @@ Layout/LeadingCommentSpace: VersionChanged: '0.73' AllowDoxygenCommentStyle: false AllowGemfileRubyComment: false + AllowRBSInlineAnnotation: false + AllowSteepAnnotation: false Layout/LeadingEmptyLines: Description: Check for unnecessary blank lines at the beginning of a file. Enabled: true @@ -723,7 +737,7 @@ Layout/LineLength: StyleGuide: "#max-line-length" Enabled: true VersionAdded: '0.25' - VersionChanged: '1.4' + VersionChanged: '1.69' Max: 120 AllowHeredoc: true AllowURI: true @@ -734,6 +748,7 @@ Layout/LineLength: AllowedPatterns: - "\\A\\s*(remote_)?test(_\\w+)?\\s.*(do|->)(\\s|\\Z)" - "\\A\\s*def test_\\w+\\s*\\Z" + SplitStrings: false 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. @@ -1115,6 +1130,11 @@ Lint/AmbiguousRegexpLiteral: Enabled: true VersionAdded: '0.17' VersionChanged: '0.83' +Lint/ArrayLiteralInRegexp: + Description: Checks for an array literal interpolated inside a regexp. + Enabled: pending + VersionAdded: '1.71' + SafeAutoCorrect: false Lint/AssignmentInCondition: Description: Don't use assignment in conditions. StyleGuide: "#safe-assignment-in-condition" @@ -1132,7 +1152,7 @@ Lint/BinaryOperatorWithIdenticalOperands: Enabled: true Safe: false VersionAdded: '0.89' - VersionChanged: '1.7' + VersionChanged: '1.69' Lint/BooleanSymbol: Description: Check for `:true` and `:false` symbols. Enabled: false @@ -1157,6 +1177,10 @@ Lint/ConstantOverwrittenInRescue: `rescue =>`. Enabled: true VersionAdded: '1.31' +Lint/ConstantReassignment: + Description: Checks for constant reassignments. + Enabled: pending + VersionAdded: '1.70' Lint/ConstantResolution: Description: Check that constants are fully qualified with `::`. Enabled: false @@ -1260,6 +1284,7 @@ Lint/DuplicateBranch: VersionChanged: '1.7' IgnoreLiteralBranches: false IgnoreConstantBranches: false + IgnoreDuplicateElseBranch: false Lint/DuplicateCaseCondition: Description: Do not repeat values in case conditionals. Enabled: false @@ -1299,6 +1324,10 @@ Lint/DuplicateRescueException: Description: Checks that there are no repeated exceptions used in `rescue` expressions. Enabled: false VersionAdded: '0.89' +Lint/DuplicateSetElement: + Description: Checks for duplicate elements in Set. + Enabled: pending + VersionAdded: '1.67' Lint/EachWithObjectArgument: Description: Check for immutable argument given to each_with_object. Enabled: true @@ -1396,6 +1425,11 @@ Lint/HashCompareByIdentity: Enabled: false Safe: false VersionAdded: '0.93' +Lint/HashNewWithKeywordArgumentsAsDefault: + Description: Checks for the deprecated use of keyword arguments for hash default + in `Hash.new`. + Enabled: pending + VersionAdded: '1.69' Lint/HeredocMethodCallPosition: Description: Checks for the ordering of a method call where the receiver of the call is a HEREDOC. @@ -1546,6 +1580,10 @@ Lint/NumberedParameterAssignment: Description: Checks for uses of numbered parameter assignment. Enabled: false VersionAdded: '1.9' +Lint/NumericOperationWithConstantResult: + Description: Checks for numeric operations with constant results. + Enabled: pending + VersionAdded: '1.69' Lint/OrAssignmentToConstant: Description: Checks unintended or-assignment to constant. Enabled: false @@ -1703,9 +1741,9 @@ Lint/SafeNavigationChain: - try! - in? Lint/SafeNavigationConsistency: - Description: 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. + Description: Check to make sure that if safe navigation is used in an `&&` or `||` + condition, consistent and appropriate safe navigation, without excess or deficiency, + is used for all method calls on the same object. Enabled: false VersionAdded: '0.55' VersionChanged: '0.77' @@ -1747,6 +1785,11 @@ Lint/ShadowingOuterLocalVariable: or block local variables. Enabled: false VersionAdded: '0.9' +Lint/SharedMutableDefault: + Description: Checks for mutable literals used as default arguments during Hash initialization. + StyleGuide: "#no-mutable-defaults" + Enabled: pending + VersionAdded: '1.70' Lint/StructNewOverride: Description: Disallow overriding the `Struct` built-in methods via `Struct.new`. Enabled: false @@ -1802,6 +1845,10 @@ Lint/UnderscorePrefixedVariableName: Enabled: true VersionAdded: '0.21' AllowKeywordBlockArguments: false +Lint/UnescapedBracketInRegexp: + Description: Checks for unescaped literal `]` in Regexp. + Enabled: pending + VersionAdded: '1.68' Lint/UnexpectedBlockArity: Description: Looks for blocks that have fewer arguments that the calling method expects. @@ -1855,10 +1902,12 @@ Lint/UnusedMethodArgument: Enabled: false AutoCorrect: contextual VersionAdded: '0.21' - VersionChanged: '1.61' + VersionChanged: '1.69' AllowUnusedKeywordArguments: false IgnoreEmptyMethods: true IgnoreNotImplementedMethods: true + NotImplementedExceptions: + - NotImplementedError Lint/UriEscapeUnescape: Description: "`URI.escape` method is obsolete and should not be used. Instead, use `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component` depending @@ -1885,8 +1934,12 @@ Lint/UselessAssignment: Enabled: true AutoCorrect: contextual VersionAdded: '0.11' - VersionChanged: '1.61' - SafeAutoCorrect: false + VersionChanged: '1.66' +Lint/UselessDefined: + Description: Checks for calls to `defined?` with strings and symbols. The result + of such a call will always be truthy. + Enabled: pending + VersionAdded: '1.69' Lint/UselessElseWithoutRescue: Description: Checks for useless `else` in `begin..end` without `rescue`. Enabled: true @@ -1899,6 +1952,10 @@ Lint/UselessMethodDefinition: VersionAdded: '0.90' VersionChanged: '1.61' Safe: false +Lint/UselessNumericOperation: + Description: Checks for useless numeric operations. + Enabled: pending + VersionAdded: '1.66' Lint/UselessRescue: Description: Checks for useless `rescue`s. Enabled: true @@ -1958,8 +2015,9 @@ Metrics/BlockNesting: StyleGuide: "#three-is-the-number-thou-shalt-count" Enabled: true VersionAdded: '0.25' - VersionChanged: '0.47' + VersionChanged: '1.65' CountBlocks: false + CountModifierForms: false Max: 3 Metrics/ClassLength: Description: Avoid classes longer than 100 lines of code. @@ -2333,12 +2391,14 @@ Style/AccessModifierDeclarations: Description: Checks style of how access modifiers are used. Enabled: false VersionAdded: '0.57' - VersionChanged: '0.81' + VersionChanged: '1.70' EnforcedStyle: group SupportedStyles: - inline - group AllowModifiersOnSymbols: true + AllowModifiersOnAttrs: true + AllowModifiersOnAliasMethod: true SafeAutoCorrect: false Style/AccessorGrouping: Description: Checks for grouping of accessors in `class` and `module` bodies. @@ -2358,6 +2418,11 @@ Style/Alias: SupportedStyles: - prefer_alias - prefer_alias_method +Style/AmbiguousEndlessMethodDefinition: + Description: Checks for endless methods inside operators of lower precedence. + StyleGuide: "#ambiguous-endless-method-defintions" + Enabled: pending + VersionAdded: '1.68' Style/AndOr: Description: Use &&/|| instead of and/or. StyleGuide: "#no-and-or-or" @@ -2451,6 +2516,12 @@ Style/BisectedAttrAccessor: method can be combined into single `attr_accessor`. Enabled: false VersionAdded: '0.87' +Style/BitwisePredicate: + Description: Prefer bitwise predicate methods over direct comparison operations. + StyleGuide: "#bitwise-predicate-methods" + Enabled: pending + Safe: false + VersionAdded: '1.68' Style/BlockComments: Description: Do not use block comments. StyleGuide: "#no-block-comments" @@ -2604,6 +2675,11 @@ Style/ColonMethodDefinition: StyleGuide: "#colon-method-definition" Enabled: false VersionAdded: '0.52' +Style/CombinableDefined: + Description: Checks successive `defined?` calls that can be combined into a single + call. + Enabled: pending + VersionAdded: '1.68' Style/CombinableLoops: Description: Checks for places where multiple consecutive loops over the same data can be combined into a single loop. @@ -2699,6 +2775,11 @@ Style/DefWithParentheses: Enabled: true VersionAdded: '0.9' VersionChanged: '0.12' +Style/DigChain: + Description: Use `dig` with multiple parameters instead of chaining multiple calls. + Enabled: pending + Safe: false + VersionAdded: '1.69' Style/Dir: Description: Use the `__dir__` method to retrieve the canonicalized absolute path to the current file. @@ -2734,6 +2815,7 @@ Style/DocumentationMethod: Description: Checks for missing documentation comment for public methods. Enabled: false VersionAdded: '0.43' + AllowedMethods: [] Exclude: - "/spec/**/*" - "/test/**/*" @@ -2887,11 +2969,21 @@ Style/FileEmpty: Enabled: true Safe: false VersionAdded: '1.48' +Style/FileNull: + Description: Use `File::NULL` instead of hardcoding "dev/null". + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '1.69' Style/FileRead: Description: Favor `File.(bin)read` convenience methods. StyleGuide: "#file-read" Enabled: false VersionAdded: '1.24' +Style/FileTouch: + Description: Favor `FileUtils.touch` for touching files. + Enabled: pending + VersionAdded: '1.69' + SafeAutoCorrect: false Style/FileWrite: Description: Favor `File.(bin)write` convenience methods. StyleGuide: "#file-write" @@ -2958,6 +3050,8 @@ Style/FrozenStringLiteralComment: - always_true - never SafeAutoCorrect: true + Exclude: + - "/**/*.arb" Details: 'Add `# frozen_string_literal: true` to the top of the file. Frozen string literals will become the default in a future Ruby version, and we want to make sure we''re ready.' @@ -3022,13 +3116,19 @@ Style/HashLikeCase: Enabled: false VersionAdded: '0.88' MinBranchesCount: 3 +Style/HashSlice: + Description: Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` + methods that can be replaced with `Hash#slice` method. + Enabled: pending + Safe: false + VersionAdded: '1.71' Style/HashSyntax: Description: 'Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax { :a => 1, :b => 2 }.' StyleGuide: "#hash-literals" Enabled: true VersionAdded: '0.9' - VersionChanged: '1.24' + VersionChanged: '1.67' EnforcedStyle: ruby19 SupportedStyles: - ruby19 @@ -3041,6 +3141,7 @@ Style/HashSyntax: - never - either - consistent + - either_consistent UseHashRocketsWithSymbolValues: false PreferHashRocketsForNonAlnumEndingSymbols: false Style/HashTransformKeys: @@ -3161,6 +3262,16 @@ Style/IpAddresses: - "/**/Gemfile" - "/**/gems.rb" - "/**/*.gemspec" +Style/ItAssignment: + Description: Checks for assignment to `it` inside a block. + Enabled: pending + VersionAdded: '1.70' +Style/KeywordArgumentsMerging: + Description: When passing an existing hash as keyword arguments, provide additional + arguments directly rather than using `merge`. + StyleGuide: "#merging-keyword-arguments" + Enabled: pending + VersionAdded: '1.68' Style/KeywordParametersOrder: Description: Enforces that optional keyword parameters are placed at the end of the parameters list. @@ -3219,6 +3330,7 @@ Style/MapIntoArray: StyleGuide: "#functional-code" Enabled: false VersionAdded: '1.63' + VersionChanged: '1.67' Safe: false Style/MapToHash: Description: Prefer `to_h` with a block over `map.to_h`. @@ -3751,7 +3863,7 @@ Style/RedundantConstantBase: Enabled: true VersionAdded: '1.40' Style/RedundantCurrentDirectoryInPath: - Description: Checks for uses a redundant current directory in path. + Description: Checks for a redundant current directory in a path given to `require_relative`. Enabled: true VersionAdded: '1.53' Style/RedundantDoubleSplatHashBraces: @@ -3815,6 +3927,10 @@ Style/RedundantInterpolation: SafeAutoCorrect: false VersionAdded: '0.76' VersionChanged: '1.30' +Style/RedundantInterpolationUnfreeze: + Description: Checks for redundant unfreezing of interpolated strings. + Enabled: pending + VersionAdded: '1.66' Style/RedundantLineContinuation: Description: Check for redundant line continuation. Enabled: true @@ -3931,13 +4047,14 @@ Style/ReturnNilInPredicateMethodDefinition: AllowedMethods: [] AllowedPatterns: [] VersionAdded: '1.53' + VersionChanged: '1.67' Style/SafeNavigation: Description: Transforms usages of a method call safeguarded by a check for the existence of the object to safe navigation (`&.`). Autocorrection is unsafe as it assumes the object will be `nil` or truthy, but never `false`. Enabled: true VersionAdded: '0.43' - VersionChanged: '1.27' + VersionChanged: '1.67' ConvertCodeThatCanStartToReturnNil: false AllowedMethods: - present? @@ -3947,6 +4064,13 @@ Style/SafeNavigation: - try! SafeAutoCorrect: false MaxChainLength: 2 +Style/SafeNavigationChainLength: + Description: Enforces safe navigation chains length to not exceed the configured + maximum. + StyleGuide: "#safe-navigation" + Enabled: pending + VersionAdded: '1.68' + Max: 2 Style/Sample: Description: Use `sample` instead of `shuffle.first`, `shuffle.last`, and `shuffle[Integer]`. Reference: https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code @@ -3977,6 +4101,13 @@ Style/Send: StyleGuide: "#prefer-public-send" Enabled: false VersionAdded: '0.33' +Style/SendWithLiteralMethodName: + Description: Detects the use of the `public_send` method with a static method name + argument. + Enabled: pending + Safe: false + AllowSend: true + VersionAdded: '1.64' Style/SignalException: Description: Checks for proper usage of fail and raise. StyleGuide: "#prefer-raise-over-fail" @@ -4125,6 +4256,11 @@ Style/StructInheritance: SafeAutoCorrect: false VersionAdded: '0.29' VersionChanged: '1.20' +Style/SuperArguments: + Description: Call `super` without arguments and parentheses when the signature is + identical. + Enabled: pending + VersionAdded: '1.64' Style/SuperWithArgsParentheses: Description: Use parentheses for `super` with arguments. StyleGuide: "#super-with-args" @@ -4156,7 +4292,7 @@ Style/SymbolProc: Enabled: true Safe: false VersionAdded: '0.26' - VersionChanged: '1.40' + VersionChanged: '1.64' AllowMethodsWithArguments: false AllowedMethods: - define_method From 8f00a57472c565c7d017e0a08b0644709d3032e0 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:45:11 -0500 Subject: [PATCH 3/6] Enable all new cops (for verification) --- rubocop.yml | 69 +++++++++++++++++++++++++++++++++++ test/fixtures/full_config.yml | 46 +++++++++++------------ 2 files changed, 92 insertions(+), 23 deletions(-) diff --git a/rubocop.yml b/rubocop.yml index 6f6543ee..ab420e15 100644 --- a/rubocop.yml +++ b/rubocop.yml @@ -884,3 +884,72 @@ Style/YAMLFileRead: Style/YodaCondition: Enabled: false + +Gemspec/AddRuntimeDependency: + Enabled: true + +Lint/ArrayLiteralInRegexp: + Enabled: true + +Lint/ConstantReassignment: + Enabled: true + +Lint/DuplicateSetElement: + Enabled: true + +Lint/HashNewWithKeywordArgumentsAsDefault: + Enabled: true + +Lint/NumericOperationWithConstantResult: + Enabled: true + +Lint/SharedMutableDefault: + Enabled: true + +Lint/UnescapedBracketInRegexp: + Enabled: true + +Lint/UselessDefined: + Enabled: true + +Lint/UselessNumericOperation: + Enabled: true + +Style/AmbiguousEndlessMethodDefinition: + Enabled: true + +Style/BitwisePredicate: + Enabled: true + +Style/CombinableDefined: + Enabled: true + +Style/DigChain: + Enabled: true + +Style/FileNull: + Enabled: true + +Style/FileTouch: + Enabled: true + +Style/HashSlice: + Enabled: true + +Style/ItAssignment: + Enabled: true + +Style/KeywordArgumentsMerging: + Enabled: true + +Style/RedundantInterpolationUnfreeze: + Enabled: true + +Style/SafeNavigationChainLength: + Enabled: true + +Style/SendWithLiteralMethodName: + Enabled: true + +Style/SuperArguments: + Enabled: true diff --git a/test/fixtures/full_config.yml b/test/fixtures/full_config.yml index eb3cef69..0ab51a4e 100644 --- a/test/fixtures/full_config.yml +++ b/test/fixtures/full_config.yml @@ -189,7 +189,7 @@ Gemspec/AddRuntimeDependency: Description: Prefer `add_dependency` over `add_runtime_dependency`. StyleGuide: "#add_dependency_vs_add_runtime_dependency" Reference: https://github.com/rubygems/rubygems/issues/7799#issuecomment-2192720316 - Enabled: pending + Enabled: true VersionAdded: '1.65' Include: - "**/*.gemspec" @@ -1132,7 +1132,7 @@ Lint/AmbiguousRegexpLiteral: VersionChanged: '0.83' Lint/ArrayLiteralInRegexp: Description: Checks for an array literal interpolated inside a regexp. - Enabled: pending + Enabled: true VersionAdded: '1.71' SafeAutoCorrect: false Lint/AssignmentInCondition: @@ -1179,7 +1179,7 @@ Lint/ConstantOverwrittenInRescue: VersionAdded: '1.31' Lint/ConstantReassignment: Description: Checks for constant reassignments. - Enabled: pending + Enabled: true VersionAdded: '1.70' Lint/ConstantResolution: Description: Check that constants are fully qualified with `::`. @@ -1326,7 +1326,7 @@ Lint/DuplicateRescueException: VersionAdded: '0.89' Lint/DuplicateSetElement: Description: Checks for duplicate elements in Set. - Enabled: pending + Enabled: true VersionAdded: '1.67' Lint/EachWithObjectArgument: Description: Check for immutable argument given to each_with_object. @@ -1428,7 +1428,7 @@ Lint/HashCompareByIdentity: Lint/HashNewWithKeywordArgumentsAsDefault: Description: Checks for the deprecated use of keyword arguments for hash default in `Hash.new`. - Enabled: pending + Enabled: true VersionAdded: '1.69' Lint/HeredocMethodCallPosition: Description: Checks for the ordering of a method call where the receiver of the @@ -1582,7 +1582,7 @@ Lint/NumberedParameterAssignment: VersionAdded: '1.9' Lint/NumericOperationWithConstantResult: Description: Checks for numeric operations with constant results. - Enabled: pending + Enabled: true VersionAdded: '1.69' Lint/OrAssignmentToConstant: Description: Checks unintended or-assignment to constant. @@ -1788,7 +1788,7 @@ Lint/ShadowingOuterLocalVariable: Lint/SharedMutableDefault: Description: Checks for mutable literals used as default arguments during Hash initialization. StyleGuide: "#no-mutable-defaults" - Enabled: pending + Enabled: true VersionAdded: '1.70' Lint/StructNewOverride: Description: Disallow overriding the `Struct` built-in methods via `Struct.new`. @@ -1847,7 +1847,7 @@ Lint/UnderscorePrefixedVariableName: AllowKeywordBlockArguments: false Lint/UnescapedBracketInRegexp: Description: Checks for unescaped literal `]` in Regexp. - Enabled: pending + Enabled: true VersionAdded: '1.68' Lint/UnexpectedBlockArity: Description: Looks for blocks that have fewer arguments that the calling method @@ -1938,7 +1938,7 @@ Lint/UselessAssignment: Lint/UselessDefined: Description: Checks for calls to `defined?` with strings and symbols. The result of such a call will always be truthy. - Enabled: pending + Enabled: true VersionAdded: '1.69' Lint/UselessElseWithoutRescue: Description: Checks for useless `else` in `begin..end` without `rescue`. @@ -1954,7 +1954,7 @@ Lint/UselessMethodDefinition: Safe: false Lint/UselessNumericOperation: Description: Checks for useless numeric operations. - Enabled: pending + Enabled: true VersionAdded: '1.66' Lint/UselessRescue: Description: Checks for useless `rescue`s. @@ -2421,7 +2421,7 @@ Style/Alias: Style/AmbiguousEndlessMethodDefinition: Description: Checks for endless methods inside operators of lower precedence. StyleGuide: "#ambiguous-endless-method-defintions" - Enabled: pending + Enabled: true VersionAdded: '1.68' Style/AndOr: Description: Use &&/|| instead of and/or. @@ -2519,7 +2519,7 @@ Style/BisectedAttrAccessor: Style/BitwisePredicate: Description: Prefer bitwise predicate methods over direct comparison operations. StyleGuide: "#bitwise-predicate-methods" - Enabled: pending + Enabled: true Safe: false VersionAdded: '1.68' Style/BlockComments: @@ -2678,7 +2678,7 @@ Style/ColonMethodDefinition: Style/CombinableDefined: Description: Checks successive `defined?` calls that can be combined into a single call. - Enabled: pending + Enabled: true VersionAdded: '1.68' Style/CombinableLoops: Description: Checks for places where multiple consecutive loops over the same data @@ -2777,7 +2777,7 @@ Style/DefWithParentheses: VersionChanged: '0.12' Style/DigChain: Description: Use `dig` with multiple parameters instead of chaining multiple calls. - Enabled: pending + Enabled: true Safe: false VersionAdded: '1.69' Style/Dir: @@ -2971,7 +2971,7 @@ Style/FileEmpty: VersionAdded: '1.48' Style/FileNull: Description: Use `File::NULL` instead of hardcoding "dev/null". - Enabled: pending + Enabled: true SafeAutoCorrect: false VersionAdded: '1.69' Style/FileRead: @@ -2981,7 +2981,7 @@ Style/FileRead: VersionAdded: '1.24' Style/FileTouch: Description: Favor `FileUtils.touch` for touching files. - Enabled: pending + Enabled: true VersionAdded: '1.69' SafeAutoCorrect: false Style/FileWrite: @@ -3119,7 +3119,7 @@ Style/HashLikeCase: Style/HashSlice: Description: Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods that can be replaced with `Hash#slice` method. - Enabled: pending + Enabled: true Safe: false VersionAdded: '1.71' Style/HashSyntax: @@ -3264,13 +3264,13 @@ Style/IpAddresses: - "/**/*.gemspec" Style/ItAssignment: Description: Checks for assignment to `it` inside a block. - Enabled: pending + Enabled: true VersionAdded: '1.70' Style/KeywordArgumentsMerging: Description: When passing an existing hash as keyword arguments, provide additional arguments directly rather than using `merge`. StyleGuide: "#merging-keyword-arguments" - Enabled: pending + Enabled: true VersionAdded: '1.68' Style/KeywordParametersOrder: Description: Enforces that optional keyword parameters are placed at the end of @@ -3929,7 +3929,7 @@ Style/RedundantInterpolation: VersionChanged: '1.30' Style/RedundantInterpolationUnfreeze: Description: Checks for redundant unfreezing of interpolated strings. - Enabled: pending + Enabled: true VersionAdded: '1.66' Style/RedundantLineContinuation: Description: Check for redundant line continuation. @@ -4068,7 +4068,7 @@ Style/SafeNavigationChainLength: Description: Enforces safe navigation chains length to not exceed the configured maximum. StyleGuide: "#safe-navigation" - Enabled: pending + Enabled: true VersionAdded: '1.68' Max: 2 Style/Sample: @@ -4104,7 +4104,7 @@ Style/Send: Style/SendWithLiteralMethodName: Description: Detects the use of the `public_send` method with a static method name argument. - Enabled: pending + Enabled: true Safe: false AllowSend: true VersionAdded: '1.64' @@ -4259,7 +4259,7 @@ Style/StructInheritance: Style/SuperArguments: Description: Call `super` without arguments and parentheses when the signature is identical. - Enabled: pending + Enabled: true VersionAdded: '1.64' Style/SuperWithArgsParentheses: Description: Use parentheses for `super` with arguments. From 7b697aaf9f5cc6065bee052955dbbd72063e1840 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:52:54 -0500 Subject: [PATCH 4/6] Fix config --- rubocop.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/rubocop.yml b/rubocop.yml index ab420e15..222cb19d 100644 --- a/rubocop.yml +++ b/rubocop.yml @@ -576,9 +576,6 @@ Style/HashExcept: Style/HashLikeCase: Enabled: false -Style/HashSyntax: - EnforcedShorthandSyntax: either - Style/HashTransformKeys: Enabled: false From 35bee371872f2ea075467dacebe7286b0b0b5d02 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:59:28 -0500 Subject: [PATCH 5/6] Sort --- rubocop.yml | 160 ++++++++++++++++++++++++++-------------------------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/rubocop.yml b/rubocop.yml index 222cb19d..3d227783 100644 --- a/rubocop.yml +++ b/rubocop.yml @@ -10,12 +10,15 @@ inherit_mode: - Include AllCops: - StyleGuideBaseURL: https://shopify.github.io/ruby-style-guide/ NewCops: disable # New cops will be triaged by style guide maintainers instead. + StyleGuideBaseURL: https://shopify.github.io/ruby-style-guide/ Bundler/OrderedGems: Enabled: false +Gemspec/AddRuntimeDependency: + Enabled: true + Gemspec/DeprecatedAttributeAssignment: Enabled: true @@ -44,8 +47,8 @@ Layout/FirstArrayElementIndentation: EnforcedStyle: consistent Layout/FirstArrayElementLineBreak: - Enabled: true AllowMultilineFinalElement: true + Enabled: true Layout/FirstHashElementIndentation: EnforcedStyle: consistent @@ -54,8 +57,8 @@ Layout/FirstHashElementLineBreak: Enabled: true Layout/FirstMethodArgumentLineBreak: - Enabled: true AllowMultilineFinalElement: true + Enabled: true Layout/HashAlignment: EnforcedLastArgumentHashStyle: ignore_implicit @@ -76,15 +79,15 @@ Layout/LineLength: - "\\A\\s*def test_\\w+\\s*\\Z" Layout/MultilineArrayLineBreaks: - Enabled: true AllowMultilineFinalElement: true + Enabled: true Layout/MultilineHashKeyLineBreaks: Enabled: true Layout/MultilineMethodArgumentLineBreaks: - Enabled: true AllowMultilineFinalElement: true + Enabled: true Layout/MultilineMethodCallIndentation: EnforcedStyle: indented @@ -111,6 +114,9 @@ Lint/AmbiguousOperatorPrecedence: Lint/AmbiguousRange: Enabled: false +Lint/ArrayLiteralInRegexp: + Enabled: true + Lint/BooleanSymbol: Enabled: false @@ -120,6 +126,9 @@ Lint/ConstantDefinitionInBlock: Lint/ConstantOverwrittenInRescue: Enabled: true +Lint/ConstantReassignment: + Enabled: true + Lint/DeprecatedConstants: Enabled: false @@ -150,6 +159,9 @@ Lint/DuplicateRequire: Lint/DuplicateRescueException: Enabled: false +Lint/DuplicateSetElement: + Enabled: true + Lint/EmptyBlock: Enabled: false @@ -180,6 +192,9 @@ Lint/FloatComparison: Lint/HashCompareByIdentity: Enabled: false +Lint/HashNewWithKeywordArgumentsAsDefault: + Enabled: true + Lint/IdentityComparison: Enabled: false @@ -228,6 +243,9 @@ Lint/NonDeterministicRequireOrder: Lint/NumberedParameterAssignment: Enabled: false +Lint/NumericOperationWithConstantResult: + Enabled: true + Lint/OrAssignmentToConstant: Enabled: false @@ -296,6 +314,9 @@ Lint/ShadowedArgument: Lint/ShadowingOuterLocalVariable: Enabled: false +Lint/SharedMutableDefault: + Enabled: true + Lint/StructNewOverride: Enabled: false @@ -317,6 +338,9 @@ Lint/TrailingCommaInAttributeDeclaration: Lint/TripleQuotes: Enabled: false +Lint/UnescapedBracketInRegexp: + Enabled: true + Lint/UnexpectedBlockArity: Enabled: false @@ -335,9 +359,15 @@ Lint/UriEscapeUnescape: Lint/UriRegexp: Enabled: false +Lint/UselessDefined: + Enabled: true + Lint/UselessMethodDefinition: Enabled: false +Lint/UselessNumericOperation: + Enabled: true + Lint/UselessRescue: Enabled: true @@ -400,10 +430,10 @@ Naming/MethodParameterName: Enabled: false Naming/PredicateName: - NamePrefix: - - is_ ForbiddenPrefixes: - is_ + NamePrefix: + - is_ Naming/RescuedExceptionsVariableName: Enabled: false @@ -432,6 +462,9 @@ Style/AccessorGrouping: Style/Alias: EnforcedStyle: prefer_alias_method +Style/AmbiguousEndlessMethodDefinition: + Enabled: true + Style/ArgumentsForwarding: Enabled: false @@ -441,6 +474,9 @@ Style/ArrayIntersect: Style/BisectedAttrAccessor: Enabled: false +Style/BitwisePredicate: + Enabled: true + Style/CaseEquality: AllowOnConstant: true AllowOnSelfClass: true @@ -452,8 +488,8 @@ Style/ClassEqualityComparison: Enabled: false Style/ClassMethodsDefinitions: - EnforcedStyle: self_class Enabled: true + EnforcedStyle: self_class Style/CollectionCompact: Enabled: false @@ -461,6 +497,9 @@ Style/CollectionCompact: Style/ColonMethodDefinition: Enabled: false +Style/CombinableDefined: + Enabled: true + Style/CombinableLoops: Enabled: false @@ -482,6 +521,9 @@ Style/DataInheritance: Style/DateTime: Enabled: true +Style/DigChain: + Enabled: true + Style/Dir: Enabled: false @@ -539,9 +581,15 @@ Style/FetchEnvVar: Style/FileEmpty: Enabled: true +Style/FileNull: + Enabled: true + Style/FileRead: Enabled: false +Style/FileTouch: + Enabled: true + Style/FileWrite: Enabled: false @@ -552,11 +600,11 @@ Style/FormatStringToken: Enabled: false Style/FrozenStringLiteralComment: - SafeAutoCorrect: true - EnforcedStyle: always_true Details: 'Add `# frozen_string_literal: true` to the top of the file. Frozen string literals will become the default in a future Ruby version, and we want to make sure we''re ready.' + EnforcedStyle: always_true + SafeAutoCorrect: true Style/GuardClause: Enabled: false @@ -576,6 +624,9 @@ Style/HashExcept: Style/HashLikeCase: Enabled: false +Style/HashSlice: + Enabled: true + Style/HashTransformKeys: Enabled: false @@ -597,6 +648,12 @@ Style/InverseMethods: Style/InvertibleUnlessCondition: Enabled: true +Style/ItAssignment: + Enabled: true + +Style/KeywordArgumentsMerging: + Enabled: true + Style/KeywordParametersOrder: Enabled: false @@ -622,7 +679,6 @@ Style/MapToSet: Enabled: false Style/MethodCallWithArgsParentheses: - Enabled: true AllowedMethods: - require - require_relative @@ -630,6 +686,7 @@ Style/MethodCallWithArgsParentheses: - yield - raise - puts + Enabled: true Exclude: - "/**/Gemfile" @@ -759,6 +816,9 @@ Style/RedundantHeredocDelimiterQuotes: Style/RedundantInitialize: Enabled: false +Style/RedundantInterpolationUnfreeze: + Enabled: true + Style/RedundantLineContinuation: Enabled: true @@ -804,9 +864,15 @@ Style/ReturnNilInPredicateMethodDefinition: Enabled: true <% end %> +Style/SafeNavigationChainLength: + Enabled: true + Style/SelectByRegexp: Enabled: false +Style/SendWithLiteralMethodName: + Enabled: true + Style/SingleArgumentDig: Enabled: false @@ -839,6 +905,9 @@ Style/StringLiteralsInInterpolation: Style/StructInheritance: Enabled: false +Style/SuperArguments: + Enabled: true + <% if rubocop_version >= "1.58" %> Style/SuperWithArgsParentheses: Enabled: true @@ -881,72 +950,3 @@ Style/YAMLFileRead: Style/YodaCondition: Enabled: false - -Gemspec/AddRuntimeDependency: - Enabled: true - -Lint/ArrayLiteralInRegexp: - Enabled: true - -Lint/ConstantReassignment: - Enabled: true - -Lint/DuplicateSetElement: - Enabled: true - -Lint/HashNewWithKeywordArgumentsAsDefault: - Enabled: true - -Lint/NumericOperationWithConstantResult: - Enabled: true - -Lint/SharedMutableDefault: - Enabled: true - -Lint/UnescapedBracketInRegexp: - Enabled: true - -Lint/UselessDefined: - Enabled: true - -Lint/UselessNumericOperation: - Enabled: true - -Style/AmbiguousEndlessMethodDefinition: - Enabled: true - -Style/BitwisePredicate: - Enabled: true - -Style/CombinableDefined: - Enabled: true - -Style/DigChain: - Enabled: true - -Style/FileNull: - Enabled: true - -Style/FileTouch: - Enabled: true - -Style/HashSlice: - Enabled: true - -Style/ItAssignment: - Enabled: true - -Style/KeywordArgumentsMerging: - Enabled: true - -Style/RedundantInterpolationUnfreeze: - Enabled: true - -Style/SafeNavigationChainLength: - Enabled: true - -Style/SendWithLiteralMethodName: - Enabled: true - -Style/SuperArguments: - Enabled: true From efd5ce5a8c0051a66432844c4aed5dc86ad2b938 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Thu, 23 Jan 2025 18:02:27 -0500 Subject: [PATCH 6/6] Bump required RuboCop version --- Gemfile.lock | 2 +- rubocop-shopify.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2d8623ee..040ff1a5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: . specs: rubocop-shopify (2.15.1) - rubocop (~> 1.51) + rubocop (~> 1.71) GEM remote: https://rubygems.org/ diff --git a/rubocop-shopify.gemspec b/rubocop-shopify.gemspec index cb7b1a13..5858d16e 100644 --- a/rubocop-shopify.gemspec +++ b/rubocop-shopify.gemspec @@ -23,5 +23,5 @@ Gem::Specification.new do |s| s.required_ruby_version = ">= 3.0.0" - s.add_dependency("rubocop", "~> 1.51") + s.add_dependency("rubocop", "~> 1.71") end