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
Is your feature request related to a problem? Please describe.
There is already a Bundler/GemVersion cop that enforces gems in the Gemfile to include a version specification.
But this cop doesn't work for gemspec files.
Describe the solution you'd like
I would like either Bundler/GemVersion to also work for gemspec files or to have a new Gemspec/GemVersion cop that would enforce version specifications in gemspec files.
Examples
spec.add_dependency 'redis' # bad
spec.add_dependency 'redis', '~> 4.5.1' # good
spec.add_development_dependency 'faker' # bad
spec.add_development_dependency 'faker', '~> 2.19.0' # good
The text was updated successfully, but these errors were encountered:
Resolve: rubocop#10570.
This cop requires/forbids version specifications or a commit reference for gem dependency in gemspec.
## example
```ruby
# EnforcedStyle: required (default)
# bad
Gem::Specification.new do |spec|
spec.add_dependency 'rubocop'
end
# good
Gem::Specification.new do |spec|
spec.add_dependency 'rubocop', '~> 1.28'
end
```
```ruby
# EnforcedStyle: forbidden
# bad
Gem::Specification.new do |spec|
spec.add_dependency 'rubocop', '~> 1.28'
end
# good
Gem::Specification.new do |spec|
spec.add_dependency 'rubocop'
end
```
Resolve: #10570.
This cop requires/forbids version specifications or a commit reference for gem dependency in gemspec.
## example
```ruby
# EnforcedStyle: required (default)
# bad
Gem::Specification.new do |spec|
spec.add_dependency 'rubocop'
end
# good
Gem::Specification.new do |spec|
spec.add_dependency 'rubocop', '~> 1.28'
end
```
```ruby
# EnforcedStyle: forbidden
# bad
Gem::Specification.new do |spec|
spec.add_dependency 'rubocop', '~> 1.28'
end
# good
Gem::Specification.new do |spec|
spec.add_dependency 'rubocop'
end
```
Is your feature request related to a problem? Please describe.
There is already a
Bundler/GemVersion
cop that enforces gems in the Gemfile to include a version specification.But this cop doesn't work for gemspec files.
Describe the solution you'd like
I would like either
Bundler/GemVersion
to also work for gemspec files or to have a newGemspec/GemVersion
cop that would enforce version specifications in gemspec files.Examples
The text was updated successfully, but these errors were encountered: