Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Ruby 3.0 and up #1755

Merged
merged 3 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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