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
Cop idea: Gemspec/RubyGemsVersionAssignment
and Gemspec/SpecificationVersionAssignment
#10245
Comments
I found a case where |
kaitithoma
pushed a commit
to kaitithoma/rubocop
that referenced
this issue
May 13, 2022
This cop checks for `rubygems_version` assignment in a gemspec file. ```ruby # bad Gem::Specification.new do |spec| spec.name = 'your_cool_gem_name' spec.rubygems_version = 2.5 end # good Gem::Specification.new do |spec| spec.name = 'your_cool_gem_name' end ```
kaitithoma
pushed a commit
to kaitithoma/rubocop
that referenced
this issue
May 13, 2022
This cop checks for `specification_version` assignment in a gemspec file. ```ruby # bad Gem::Specification.new do |spec| spec.name = 'your_cool_gem_name' spec.specification_version = 2.5 end # good Gem::Specification.new do |spec| spec.name = 'your_cool_gem_name' end ```
kaitithoma
pushed a commit
to kaitithoma/rubocop
that referenced
this issue
Jun 15, 2022
Gemspec/DateAssignment functionality is integrated into Gemspec/DeprecatedAttributeAssignment
kaitithoma
pushed a commit
to kaitithoma/rubocop
that referenced
this issue
Jun 15, 2022
Add specification_version and rubygems_version to Gemspec/DeprecatedAttributeAssignment
bbatsov
pushed a commit
that referenced
this issue
Jun 20, 2022
Add specification_version and rubygems_version to Gemspec/DeprecatedAttributeAssignment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
I've found some (older) gems using
rubygems_version=
orspecification_version=
in a gemspec file.However, RubyGems source says not to use them.
https://github.com/rubygems/rubygems/blob/cc6f96aa0c1c99d94363d12884001a2de28da033/lib/rubygems/specification.rb#L530-L534
https://github.com/rubygems/rubygems/blob/cc6f96aa0c1c99d94363d12884001a2de28da033/lib/rubygems/specification.rb#L744-L748
I thought it would be a good idea to handle it the same way as
Gemspec/DateAssignment
, which was added in #9496.Describe the solution you'd like
I suggest adding cops like
Gemspec/RubyGemsVersionAssignment
andGemspec/SpecificationVersionAssignment
that warn the use ofrubygems_version=
orspecification_version=
in a gemspec file.Describe alternatives you've considered
Or merge them with
Gemspec/DateAssignment
and rename it?Additional context
For example, Jeweler and the gems created by it (e.g. OS) use these fields.
https://github.com/technicalpickles/jeweler/blob/2ab86309fc2494ba2a4e9c86c514742cd4f681c2/jeweler.gemspec#L193
https://github.com/rdp/os/blob/1245b3a1821c5cf0ff5167069f70b70658752491/os.gemspec#L42
The text was updated successfully, but these errors were encountered: