-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Description
RuboCop crashes when specifying the required_ruby_version
in the gemspec
using multiple version constraints in the Gem::Requirement
initializer.
Expected behavior
RuboCop should be able to handle multiple version constraints in the Gem::Requirement
initializer.
Actual behavior
For /Users/.../xyz: configuration from /Users/.../xyz/.rubocop.yml
Inheriting configuration from /Users/.../xyz/vendor/bundle/gems/standards-1.18.0/.standards_rubocop.yml
configuration from /Users/.../xyz/vendor/bundle/gems/rubocop-rails-2.15.2/config/default.yml
configuration from /Users/.../xyz/vendor/bundle/gems/rubocop-rails-2.15.2/config/default.yml
Default configuration from /Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/config/default.yml
undefined method `value' for s(:send,
s(:const,
s(:const, nil, :Gem), :Requirement), :new,
s(:array,
s(:send,
s(:str, ">= 3.1"), :freeze),
s(:send,
s(:str, "< 3.3"), :freeze))):RuboCop::AST::SendNode
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:202:in `version_from_right_hand_side'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:211:in `find_default_minimal_known_ruby'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:176:in `find_version'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:29:in `initialize'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:253:in `new'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:253:in `block in source'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:253:in `each'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:253:in `each'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:253:in `each'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:253:in `each'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:253:in `each'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:253:in `detect'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:253:in `source'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/target_ruby.rb:257:in `version'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_validator.rb:64:in `target_ruby_version'
/opt/ruby/ruby-3.2.1-p31/lib/ruby/3.2.0/forwardable.rb:240:in `target_ruby_version'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_obsoletion/parameter_rule.rb:36:in `applies_to_current_ruby_version?'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_obsoletion/parameter_rule.rb:22:in `violated?'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_obsoletion.rb:97:in `block in obsoletions'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_obsoletion.rb:96:in `map'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_obsoletion.rb:96:in `obsoletions'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_obsoletion.rb:40:in `reject_obsolete!'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_validator.rb:78:in `check_obsoletions'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_validator.rb:44:in `validate'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config.rb:55:in `check'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config.rb:26:in `create'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_loader.rb:65:in `load_file'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_loader_resolver.rb:214:in `block in base_configs'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_loader_resolver.rb:213:in `map'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_loader_resolver.rb:213:in `base_configs'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_loader_resolver.rb:21:in `resolve_inheritance'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_loader.rb:58:in `load_file'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_loader.rb:112:in `configuration_from_file'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_store.rb:68:in `for_dir'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/config_store.rb:47:in `for_pwd'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/cli.rb:145:in `parallel_by_default!'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/cli.rb:49:in `block in run'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/cli.rb:77:in `profile_if_needed'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/lib/rubocop/cli.rb:43:in `run'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/exe/rubocop:19:in `block in <top (required)>'
/opt/ruby/ruby-3.2.1-p31/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'
/Users/.../xyz/vendor/bundle/gems/rubocop-1.55.0/exe/rubocop:19:in `<top (required)>'
/Users/.../xyz/vendor/bundle/bin/rubocop:25:in `load'
/Users/.../xyz/vendor/bundle/bin/rubocop:25:in `<main>'
Finished in 0.580071999997017 seconds
Steps to reproduce the problem
Add the following to a *.gemspec
file:
s.required_ruby_version = Gem::Requirement.new([">= 3.1".freeze, "< 3.3".freeze])
Or, add the following to a Rakefile
and generate a new gemspec:
spec.required_ruby_version = '>= 3.1', '< 3.3'
RuboCop version
This call also fails with the above content in the gemspec
.
Here the output with required_ruby_version
removed:
bin/ruby -S rubocop -V
1.55.0 (using Parser 3.2.2.3, rubocop-ast 1.29.0, running on ruby 3.2.1) [x86_64-darwin22]
- rubocop-rails 2.15.2
sudoremo
Metadata
Metadata
Assignees
Labels
No labels