You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An attribute assignment method calls should be listed only once
in a gemspec.
Assigning to an attribute with the same name using spec.foo = will be
an unintended usage. On the other hand, duplication of methods such
as spec.requirements, spec.add_runtime_dependency, and others are
permitted because it is the intended use of appending values.
Dependencies in the gemspec should be alphabetically sorted.
Examples
# badspec.add_dependency'rubocop'spec.add_dependency'rspec'# goodspec.add_dependency'rspec'spec.add_dependency'rubocop'# goodspec.add_dependency'rubocop'spec.add_dependency'rspec'# badspec.add_development_dependency'rubocop'spec.add_development_dependency'rspec'# goodspec.add_development_dependency'rspec'spec.add_development_dependency'rubocop'# goodspec.add_development_dependency'rubocop'spec.add_development_dependency'rspec'# badspec.add_runtime_dependency'rubocop'spec.add_runtime_dependency'rspec'# goodspec.add_runtime_dependency'rspec'spec.add_runtime_dependency'rubocop'# goodspec.add_runtime_dependency'rubocop'spec.add_runtime_dependency'rspec'# good only if TreatCommentsAsGroupSeparators is true# For code qualityspec.add_dependency'rubocop'# For testsspec.add_dependency'rspec'
Configurable attributes
Name
Default value
Configurable values
TreatCommentsAsGroupSeparators
true
Boolean
Include
**/*.gemspec
Array
Gemspec/RequiredRubyVersion
Enabled by default
Safe
Supports autocorrection
VersionAdded
VersionChanged
Enabled
Yes
No
0.52
-
Checks that required_ruby_version of gemspec and TargetRubyVersion
of .rubocop.yml are equal.
Thereby, RuboCop to perform static analysis working on the version
required by gemspec.
Examples
# When `TargetRubyVersion` of .rubocop.yml is `2.3`.# badGem::Specification.newdo |spec|
spec.required_ruby_version='>= 2.2.0'end# badGem::Specification.newdo |spec|
spec.required_ruby_version='>= 2.4.0'end# goodGem::Specification.newdo |spec|
spec.required_ruby_version='>= 2.3.0'end# goodGem::Specification.newdo |spec|
spec.required_ruby_version='>= 2.3'end# goodGem::Specification.newdo |spec|
spec.required_ruby_version=['>= 2.3.0','< 2.5.0']end