From c2519ab584657d07c78f18c607f7b624cafdaa60 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sun, 15 Dec 2024 17:49:14 +0100 Subject: [PATCH] Set `RSpec/DescribedClass` cop to `explicit` Additionally: - Autofix offenses - Update RuboCop dependencies and set require to false - Regenerate rubocop_todo.yml Ref: https://github.com/jamesmartin/inline_svg/pull/177#issuecomment-2530239552 --- .rubocop.yml | 4 ++++ .rubocop_todo.yml | 18 ++---------------- Gemfile | 10 +++++----- spec/static_asset_finder_spec.rb | 4 ++-- spec/webpack_asset_finder_spec.rb | 2 +- 5 files changed, 14 insertions(+), 24 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b977244..91edd84 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -15,3 +15,7 @@ AllCops: # https://github.com/jamesmartin/inline_svg/pull/171/files#r1798763446 Style/EachWithObject: Enabled: false + +# https://github.com/jamesmartin/inline_svg/pull/177#issuecomment-2530239552 +RSpec/DescribedClass: + EnforcedStyle: explicit diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 9c7ee77..9c1db66 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --no-offense-counts --no-auto-gen-timestamp` -# using RuboCop version 1.66.1. +# using RuboCop version 1.69.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -42,13 +42,6 @@ Lint/UnusedBlockArgument: - 'lib/inline_svg/railtie.rb' - 'lib/inline_svg/transform_pipeline/transformations.rb' -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AutoCorrect. -Lint/UselessAssignment: - Exclude: - - 'spec/cached_asset_file_spec.rb' - - 'spec/transformation_pipeline/transformations/transformation_spec.rb' - # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: Max: 19 @@ -80,12 +73,6 @@ RSpec/ContextWording: - 'spec/transformation_pipeline/transformations/aria_attributes_spec.rb' - 'spec/transformation_pipeline/transformations_spec.rb' -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants. -# SupportedStyles: described_class, explicit -RSpec/DescribedClass: - Enabled: false - # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AutoCorrect. RSpec/EmptyExampleGroup: @@ -158,7 +145,6 @@ RSpec/VerifiedDoubles: # AllowedMethods: lambda, proc, it Style/BlockDelimiters: Exclude: - - 'lib/inline_svg/transform_pipeline/transformations.rb' - 'spec/helpers/inline_svg_spec.rb' # This cop supports safe autocorrection (--autocorrect). @@ -275,7 +261,7 @@ Style/TrivialAccessors: - 'lib/inline_svg.rb' # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings. # URISchemes: http, https Layout/LineLength: Max: 183 diff --git a/Gemfile b/Gemfile index f9655d0..26fd75f 100644 --- a/Gemfile +++ b/Gemfile @@ -10,8 +10,8 @@ gem "pry" gem "rake" gem "rspec" -gem "rubocop", "1.66.1" -gem "rubocop-packaging", "0.5.2" -gem "rubocop-performance", "1.22.1" -gem "rubocop-rake", "0.6.0" -gem "rubocop-rspec", "3.0.5" +gem "rubocop", "1.69.2", require: false +gem "rubocop-packaging", "0.5.2", require: false +gem "rubocop-performance", "1.23.0", require: false +gem "rubocop-rake", "0.6.0", require: false +gem "rubocop-rspec", "3.3.0", require: false diff --git a/spec/static_asset_finder_spec.rb b/spec/static_asset_finder_spec.rb index 1807992..fc67a28 100644 --- a/spec/static_asset_finder_spec.rb +++ b/spec/static_asset_finder_spec.rb @@ -8,7 +8,7 @@ stub_const('Rails', double('Rails').as_null_object) expect(Rails.application.config.assets).to receive(:compile).and_return(true) - expect(described_class.find_asset('some-file').pathname).to be_nil + expect(InlineSvg::StaticAssetFinder.find_asset('some-file').pathname).to be_nil end end @@ -21,7 +21,7 @@ expect(asset).to receive(:filename).and_return(pathname) expect(Rails.application.assets).to receive(:[]).with('some-file').and_return(asset) - expect(described_class.find_asset('some-file').pathname).to eq(pathname) + expect(InlineSvg::StaticAssetFinder.find_asset('some-file').pathname).to eq(pathname) end end end diff --git a/spec/webpack_asset_finder_spec.rb b/spec/webpack_asset_finder_spec.rb index 006178e..35a7f69 100644 --- a/spec/webpack_asset_finder_spec.rb +++ b/spec/webpack_asset_finder_spec.rb @@ -9,7 +9,7 @@ stub_const('Shakapacker', double('Shakapacker').as_null_object) expect(Shakapacker.manifest).to receive(:lookup).with('some-file').and_return(nil) - expect(described_class.find_asset('some-file').pathname).to be_nil + expect(InlineSvg::WebpackAssetFinder.find_asset('some-file').pathname).to be_nil end end end