From ef157848fde9877f6d9f88e234ebbce1d6ef8655 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Wed, 27 Dec 2023 14:30:44 +0100 Subject: [PATCH 1/3] Drop support for Ruby 2.7 --- .rubocop.yml | 2 +- reek.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 25fa8ce80..154500eec 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,7 +12,7 @@ AllCops: Exclude: - 'samples/**/*' NewCops: enable - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.0 # Tables are nice Layout/HashAlignment: diff --git a/reek.gemspec b/reek.gemspec index b2604dc69..d078fae3e 100644 --- a/reek.gemspec +++ b/reek.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^bin/}).map { |path| File.basename(path) } spec.rdoc_options = %w(--main README.md -x assets/|bin/|config/|features/|spec/|tasks/) - spec.required_ruby_version = '>= 2.7.0' + spec.required_ruby_version = '>= 3.0.0' spec.metadata = { 'homepage_uri' => 'https://github.com/troessner/reek', From 063b25ea1f36cab1d427104cd0706da23248fb16 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Wed, 27 Dec 2023 21:24:42 +0100 Subject: [PATCH 2/3] Build with Rubies 3.0 through 3.3 in CI --- .github/workflows/ruby.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index f9fd01fd4..daa797976 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: - ruby: ["2.7", "3.0", "3.1", "3.2", "3.3", "jruby-9.4"] + ruby: ["3.0", "3.1", "3.2", "jruby-9.4", "3.3"] steps: - uses: actions/checkout@v4 @@ -51,7 +51,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.2" + ruby-version: "3.3" bundler-cache: true - name: Run RuboCop run: bundle exec rubocop -P From c0eddc36e7307e442064dd49798596bff846966e Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Thu, 28 Dec 2023 15:47:36 +0100 Subject: [PATCH 3/3] Autocorrect new RuboCop offenses --- lib/reek/cli/command/todo_list_command.rb | 2 +- lib/reek/code_climate/code_climate_fingerprint.rb | 2 +- lib/reek/code_comment.rb | 4 ++-- .../errors/bad_detector_configuration_key_in_comment_error.rb | 2 +- lib/reek/errors/bad_detector_in_comment_error.rb | 2 +- .../errors/garbage_detector_configuration_in_comment_error.rb | 2 +- lib/reek/errors/legacy_comment_separator_error.rb | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/reek/cli/command/todo_list_command.rb b/lib/reek/cli/command/todo_list_command.rb index 19c553e76..bd9e31291 100644 --- a/lib/reek/cli/command/todo_list_command.rb +++ b/lib/reek/cli/command/todo_list_command.rb @@ -13,7 +13,7 @@ module Command # class TodoListCommand < BaseCommand HEADER = "# Auto generated by Reeks --todo flag\n" - EXISTING_FILE_MESSAGE = "\nExisting '#{DEFAULT_CONFIGURATION_FILE_NAME}' detected - aborting.\n" + EXISTING_FILE_MESSAGE = "\nExisting '#{DEFAULT_CONFIGURATION_FILE_NAME}' detected - aborting.\n".freeze NO_SMELLS_FOUND_MESSAGE = "\nNo smells found - nothing to do, exiting.\n" def execute diff --git a/lib/reek/code_climate/code_climate_fingerprint.rb b/lib/reek/code_climate/code_climate_fingerprint.rb index 2dcb20b89..bcf546d2f 100644 --- a/lib/reek/code_climate/code_climate_fingerprint.rb +++ b/lib/reek/code_climate/code_climate_fingerprint.rb @@ -36,7 +36,7 @@ def identifying_aspects end def parameters - warning.parameters.reject { |key, _| NON_IDENTIFYING_PARAMETERS.include?(key) }.sort.to_s + warning.parameters.except(*NON_IDENTIFYING_PARAMETERS).sort.to_s end def warning_uniquely_identifiable? diff --git a/lib/reek/code_comment.rb b/lib/reek/code_comment.rb index ee521ae2f..4ad1abb5e 100644 --- a/lib/reek/code_comment.rb +++ b/lib/reek/code_comment.rb @@ -19,8 +19,8 @@ class CodeComment (\w+) # smell detector e.g.: UncommunicativeVariableName (:?\s*) # separator (\{.*?\})? # details in hash style e.g.: { max_methods: 30 } - /x.freeze - SANITIZE_REGEX = /(#|\n|\s)+/.freeze # Matches '#', newlines and > 1 whitespaces. + /x + SANITIZE_REGEX = /(#|\n|\s)+/ # Matches '#', newlines and > 1 whitespaces. DISABLE_DETECTOR_CONFIGURATION = '{ enabled: false }' MINIMUM_CONTENT_LENGTH = 2 diff --git a/lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb b/lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb index a50b56c6c..b988716aa 100644 --- a/lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb +++ b/lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb @@ -8,7 +8,7 @@ module Errors # Gets raised when trying to configure a detector with an option # which is unknown to it. class BadDetectorConfigurationKeyInCommentError < BaseError - UNKNOWN_SMELL_DETECTOR_MESSAGE = <<-MESSAGE + UNKNOWN_SMELL_DETECTOR_MESSAGE = <<-MESSAGE.freeze Error: You are trying to configure the smell detector '%s' in one of your source code comments with the unknown option %