-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add new Gemspec/DateAssignment
cop
#9496
Add new Gemspec/DateAssignment
cop
#9496
Conversation
Follow rubocop/rubocop-rails#432. This PR adds new `Gemspec/DateAssignment` cop. This cop checks that `date =` is not used in gemspec file. It is set automatically when the gem is packaged. ```ruby # bad Gem::Specification.new do |spec| s.name = 'your_cool_gem' spec.date = Time.now.strftime('%Y-%m-%d') end # good Gem::Specification.new do |spec| s.name = 'your_cool_gem' end ``` RubyGems doesn't expect the value to be set. https://github.com/rubygems/rubygems/blob/be08d8307eda3b61f0ec0460fe7fbcf647b526e6/lib/rubygems/specification.rb#L1679-L1681
bdd1913
to
5e94c53
Compare
Include: | ||
- '**/*.gemspec' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will include gemspecs in vendored gems, which may have the date set but be out of the control of the developer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. However this setting is the same as other Gemspec department's cops. These cops hasn't received feedback on that issue, so I think we see reactions with this setting.
Love it! |
* Update rubocop from 1.12.1 to [1.13.0](https://github.com/rubocop-hq/rubocop/releases/tag/v1.13.0) * Update rubocop-performance from 1.9.2 to [1.11.1](https://github.com/rubocop-hq/rubocop-performance/releases/tag/v1.11.1) * Enabled the following rules: * [`Performance/RedundantSplitRegexpArgument`](rubocop/rubocop-performance#190) * [`Style/IfWithBooleanLiteralBranches`](rubocop/rubocop#9396) * [`Lint/TripleQuotes`](rubocop/rubocop#9402) * [`Lint/SymbolConversion`](rubocop/rubocop#9362) * [`Lint/OrAssignmentToConstant`](rubocop/rubocop#9363) * [`Lint/NumberedParameterAssignment`](rubocop/rubocop#9326) * [`Style/HashConversion`](rubocop/rubocop#9478) * [`Gemspec/DateAssignment`](rubocop/rubocop#9496) * [`Style/StringChars`](rubocop/rubocop#9615)
Follow rubocop/rubocop-rails#432.
This PR adds new
Gemspec/DateAssignment
cop.This cop checks that
date =
is not used in gemspec file. It is set automatically when the gem is packaged.RubyGems doesn't expect the value to be set.
https://github.com/rubygems/rubygems/blob/be08d8307eda3b61f0ec0460fe7fbcf647b526e6/lib/rubygems/specification.rb#L1679-L1681
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.