Add new Gemspec/DateAssignment cop#9496
Merged
bbatsov merged 1 commit intorubocop:masterfrom Feb 12, 2021
Merged
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
dvandersluis
reviewed
Feb 8, 2021
Comment on lines
+210
to
+211
| Include: | ||
| - '**/*.gemspec' |
Member
There was a problem hiding this comment.
This will include gemspecs in vendored gems, which may have the date set but be out of the control of the developer.
Member
Author
There was a problem hiding this comment.
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.
Collaborator
|
Love it! |
This was referenced Mar 6, 2021
Closed
This was referenced Mar 15, 2021
This was referenced Mar 17, 2021
jmkoni
pushed a commit
to standardrb/standard
that referenced
this pull request
May 3, 2021
* 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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow rubocop/rubocop-rails#432.
This PR adds new
Gemspec/DateAssignmentcop.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}.mdif the new code introduces user-observable changes. See changelog entry format for details.