Skip to content

Commit

Permalink
Merge pull request #1755 from troessner/support-ruby-3-and-up
Browse files Browse the repository at this point in the history
Support Ruby 3.0 and up
  • Loading branch information
mvz authored Dec 28, 2023
2 parents 17721d2 + c0eddc3 commit 47cf940
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AllCops:
Exclude:
- 'samples/**/*'
NewCops: enable
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0

# Tables are nice
Layout/HashAlignment:
Expand Down
2 changes: 1 addition & 1 deletion lib/reek/cli/command/todo_list_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/reek/code_climate/code_climate_fingerprint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
4 changes: 2 additions & 2 deletions lib/reek/code_comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 '%<detector>s'
in one of your source code comments with the unknown option %<option>s.
Expand Down
2 changes: 1 addition & 1 deletion lib/reek/errors/bad_detector_in_comment_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Errors
# This might happen for multiple reasons. The users might have a typo in
# his comment or he might use a detector that does not exist anymore.
class BadDetectorInCommentError < BaseError
UNKNOWN_SMELL_DETECTOR_MESSAGE = <<-MESSAGE
UNKNOWN_SMELL_DETECTOR_MESSAGE = <<-MESSAGE.freeze
Error: You are trying to configure an unknown smell detector '%<detector>s' in one
of your source code comments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Errors
# Gets raised when trying to use a configuration for a detector
# that can't be parsed into a hash.
class GarbageDetectorConfigurationInCommentError < BaseError
BAD_DETECTOR_CONFIGURATION_MESSAGE = <<-MESSAGE
BAD_DETECTOR_CONFIGURATION_MESSAGE = <<-MESSAGE.freeze
Error: You are trying to configure the smell detector '%<detector>s'.
Unfortunately we cannot parse the configuration you have given.
Expand Down
2 changes: 1 addition & 1 deletion lib/reek/errors/legacy_comment_separator_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Reek
module Errors
# Gets raised for old-style comment configuration format.
class LegacyCommentSeparatorError < BaseError
MESSAGE = <<-MESSAGE
MESSAGE = <<-MESSAGE.freeze
Error: You are using the legacy configuration format (including three
colons) to configure Reek in one your source code comments.
Expand Down
2 changes: 1 addition & 1 deletion reek.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 47cf940

Please sign in to comment.