diff --git a/.rubocop.yml b/.rubocop.yml index f818d06..c29e870 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,6 @@ -inherit_from: .rubocop_todo.yml +--- + +inherit_from: ".rubocop_todo.yml" # The behaviour of RuboCop can be controlled via the .rubocop.yml # configuration file. It makes it possible to enable/disable @@ -9,19 +11,24 @@ inherit_from: .rubocop_todo.yml # RuboCop will start looking for the configuration file in the directory # where the inspected file is and continue its way up to the root directory. # -# See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md +# See https://docs.rubocop.org/rubocop/latest/configuration.html + +plugins: +- rubocop-rake +- rubocop-rspec + +AllCops: + NewCops: enable -require: rubocop-rspec +Gemspec/DevelopmentDependencies: + EnforcedStyle: gemspec Layout/LineLength: Max: 120 -# Blocks are used to structure tests and are part of the rspec dsl. -# The standard BlockLength limits are too stringent for this purpose. -Metrics/BlockLength: - ExcludedMethods: - - describe - - context +# This isn't something we need to be strict about, and the default of 5 is too low for our tests. +RSpec/MultipleMemoizedHelpers: + Max: 7 # Increase the acceptable nesting levels. While we don't want # 4 nested contexts, it appears that the cop is also counting @@ -31,23 +38,6 @@ Metrics/BlockLength: RSpec/NestedGroups: Max: 4 -# Pending cops in 0.83 can be removed once enabled in bulk -# see https://docs.rubocop.org/en/latest/versioning/: -Layout/SpaceAroundMethodCallOperator: - Enabled: true -Lint/RaiseException: - Enabled: true -Lint/StructNewOverride: - Enabled: true -Style/ExponentialNotation: - Enabled: true -Style/HashEachMethods: - Enabled: true -Style/HashTransformKeys: - Enabled: true -Style/HashTransformValues: - Enabled: true -Layout/EmptyLinesAroundAttributeAccessor: - Enabled: true -Style/SlicingWithRange: - Enabled: true +# The single-line syntax can be clearer than the multi-line version for multiple definitions +Style/EmptyClassDefinition: + Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 50661b3..601fba3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,12 +1,27 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-09-22 13:23:22 UTC using RuboCop version 1.56.3. +# on 2026-04-29 17:06:59 UTC using RuboCop version 1.86.1. # 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 # versions of RuboCop, may require this file to be generated again. -# Offense count: 13 -# Configuration parameters: AllowSubject. -RSpec/MultipleMemoizedHelpers: - Max: 7 +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Gemspec/RequireMFA: + Exclude: + - 'record_loader.gemspec' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. +Style/GuardClause: + Exclude: + - 'record_loader.gemspec' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/ReduceToHash: + Exclude: + - 'lib/generators/record_loader/record_loader_generator.rb' + - 'lib/record_loader.rb' diff --git a/Gemfile.lock b/Gemfile.lock index 475605e..3196b27 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,26 +6,26 @@ PATH GEM remote: https://rubygems.org/ specs: - ast (2.4.2) - base64 (0.1.1) + ast (2.4.3) coderay (1.1.3) diff-lcs (1.5.0) - docile (1.4.0) - json (2.6.3) - language_server-protocol (3.17.0.3) + docile (1.4.1) + json (2.19.4) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) method_source (1.0.0) - parallel (1.23.0) - parser (3.2.2.3) + parallel (1.28.0) + parser (3.3.11.1) ast (~> 2.4.1) racc + prism (1.9.0) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - racc (1.7.1) + racc (1.8.1) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.8.1) - rexml (3.2.6) + regexp_parser (2.12.0) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -39,37 +39,37 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.1) - rubocop (1.56.3) - base64 (~> 0.1.1) + rubocop (1.86.1) json (~> 2.3) - language_server-protocol (>= 3.17.0) - parallel (~> 1.10) - parser (>= 3.2.2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.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.28.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) - rubocop-capybara (2.19.0) - rubocop (~> 1.41) - rubocop-factory_bot (2.24.0) - rubocop (~> 1.33) - rubocop-rspec (2.24.0) - rubocop (~> 1.33) - rubocop-capybara (~> 2.17) - rubocop-factory_bot (~> 2.22) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.49.1) + parser (>= 3.3.7.2) + prism (~> 1.7) + rubocop-rake (0.7.1) + lint_roller (~> 1.1) + rubocop (>= 1.72.1) + rubocop-rspec (3.9.0) + lint_roller (~> 1.1) + rubocop (~> 1.81) ruby-progressbar (1.13.0) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.2) simplecov-lcov (0.9.0) simplecov_json_formatter (0.1.4) - unicode-display_width (2.4.2) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) yard (0.9.34) PLATFORMS @@ -82,7 +82,8 @@ DEPENDENCIES record_loader! rspec (~> 3.12) rubocop (~> 1.56) - rubocop-rspec (~> 2.24) + rubocop-rake (~> 0.7.1) + rubocop-rspec (~> 3.0) simplecov (~> 0.22) simplecov-lcov (~> 0.9) yard (~> 0.9) diff --git a/Rakefile b/Rakefile index 73b9664..9dec6b5 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,10 @@ # frozen_string_literal: true # We add preflight to the release task pre-requisites before loading in the -# bundler/gem_tasks to ensure that it runs first. This is becuase 'release' is +# bundler/gem_tasks to ensure that it runs first. This is because 'release' is # actually composed entirely of pre-requisites and so would otherwise end up # running the pre-flight tasks AFTER everything else +desc 'Runs the preflight checklist before building a release' task release: :preflight require 'bundler/gem_tasks' diff --git a/record_loader.gemspec b/record_loader.gemspec index 9d65c29..743cb26 100644 --- a/record_loader.gemspec +++ b/record_loader.gemspec @@ -27,8 +27,7 @@ Gem::Specification.new do |spec| spec.metadata['source_code_uri'] = 'https://www.github.com/sanger/record_loader' # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here." else - raise 'RubyGems 2.0 or newer is required to protect against ' \ - 'public gem pushes.' + raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' end # Specify which files should be added to the gem when it is released. @@ -46,7 +45,8 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec', '~> 3.12' spec.add_development_dependency 'rubocop', '~> 1.56' - spec.add_development_dependency 'rubocop-rspec', '~> 2.24' + spec.add_development_dependency 'rubocop-rake', '~> 0.7.1' + spec.add_development_dependency 'rubocop-rspec', '~> 3.0' spec.add_development_dependency 'simplecov', '~> 0.22' spec.add_development_dependency 'simplecov-lcov', '~> 0.9' spec.add_development_dependency 'yard', '~> 0.9' diff --git a/spec/record_loader/attribute_spec.rb b/spec/record_loader/attribute_spec.rb index 7ee39e8..f83539e 100644 --- a/spec/record_loader/attribute_spec.rb +++ b/spec/record_loader/attribute_spec.rb @@ -2,7 +2,7 @@ require 'record_loader/attribute' -RSpec.describe RecordLoader::Attribute, type: :model, loader: true do +RSpec.describe RecordLoader::Attribute, :loader, type: :model do subject(:attribute) do described_class.new(name, type, default) end @@ -178,13 +178,13 @@ context 'without a default' do let(:default) { nil } - it { is_expected.to eq false } + it { is_expected.to be false } end context 'with a default' do let(:default) { true } - it { is_expected.to eq true } + it { is_expected.to be true } end end end diff --git a/spec/record_loader/base_spec.rb b/spec/record_loader/base_spec.rb index effa5ac..5223bd0 100644 --- a/spec/record_loader/base_spec.rb +++ b/spec/record_loader/base_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe RecordLoader::Base, type: :model, loader: true do +RSpec.describe RecordLoader::Base, :loader, type: :model do subject(:record_loader) do allow(ENV).to receive(:fetch).with('WIP', '').and_return(wip_flags) custom_subclass.new(**options) diff --git a/spec/record_loader_spec.rb b/spec/record_loader_spec.rb index a8a401a..3972111 100644 --- a/spec/record_loader_spec.rb +++ b/spec/record_loader_spec.rb @@ -2,6 +2,6 @@ RSpec.describe RecordLoader do it 'has a version number' do - expect(RecordLoader::VERSION).not_to be nil + expect(RecordLoader::VERSION).not_to be_nil end end