Skip to content

Commit

Permalink
Add VersionAdded metadata to cops who missing the version
Browse files Browse the repository at this point in the history
All cops have `VersionAdded`. This PR adds `VersionAdded` metadata to
cops who missing the version.

The cops who were missing `VersionAdded` are:

- Migration/DepartmentName (0.75) ... 1f84782
- Lint/RedundantSplatExpansion (0.76) ... ba43182
- Lint/ToJSON (0.66) ... a823c57

Also `VersionAdded` does not include tiny version.

This PR will add these rules to the project_spec.rb.
  • Loading branch information
koic authored and bbatsov committed Mar 18, 2020
1 parent 129b014 commit bf9fc25
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
6 changes: 4 additions & 2 deletions config/default.yml
Expand Up @@ -1594,7 +1594,7 @@ Lint/RedundantRequireStatement:
Lint/RedundantSplatExpansion:
Description: 'Checks for splat unnecessarily being called on literals.'
Enabled: true
VersionChanged: '0.76'
VersionAdded: '0.76'

Lint/RedundantStringCoercion:
Description: 'Checks for Object#to_s usage in string interpolation.'
Expand Down Expand Up @@ -1725,6 +1725,7 @@ Lint/Syntax:
Lint/ToJSON:
Description: 'Ensure #to_json includes an optional argument.'
Enabled: true
VersionAdded: '0.66'

Lint/UnderscorePrefixedVariableName:
Description: 'Do not use prefix `_` for a variable that is used.'
Expand Down Expand Up @@ -1908,6 +1909,7 @@ Migration/DepartmentName:
Check that cop names in rubocop:disable (etc) comments are
given with department name.
Enabled: true
VersionAdded: '0.75'

#################### Naming ##############################

Expand Down Expand Up @@ -2958,7 +2960,7 @@ Style/LambdaCall:
Description: 'Use lambda.call(...) instead of lambda.(...).'
StyleGuide: '#proc-call'
Enabled: true
VersionAdded: '0.13.1'
VersionAdded: '0.13'
VersionChanged: '0.14'
EnforcedStyle: call
SupportedStyles:
Expand Down
4 changes: 2 additions & 2 deletions manual/cops_lint.md
Expand Up @@ -1638,7 +1638,7 @@ require 'unloaded_feature'

Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
--- | --- | --- | --- | ---
Enabled | Yes | Yes | - | 0.76
Enabled | Yes | Yes | 0.76 | -

This cop checks for unneeded usages of splat expansion

Expand Down Expand Up @@ -2382,7 +2382,7 @@ into RuboCop's offenses.

Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
--- | --- | --- | --- | ---
Enabled | Yes | Yes | - | -
Enabled | Yes | Yes | 0.66 | -

This cop checks to make sure `#to_json` includes an optional argument.
When overriding `#to_json`, callers may invoke JSON
Expand Down
2 changes: 1 addition & 1 deletion manual/cops_migration.md
Expand Up @@ -4,7 +4,7 @@

Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
--- | --- | --- | --- | ---
Enabled | Yes | Yes | - | -
Enabled | Yes | Yes | 0.75 | -

Check that cop names in rubocop:disable comments are given with
department name.
2 changes: 1 addition & 1 deletion manual/cops_style.md
Expand Up @@ -3042,7 +3042,7 @@ EnforcedStyle | `line_count_dependent` | `line_count_dependent`, `lambda`, `lite

Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
--- | --- | --- | --- | ---
Enabled | Yes | Yes | 0.13.1 | 0.14
Enabled | Yes | Yes | 0.13 | 0.14

This cop checks for use of the lambda.(args) syntax.

Expand Down
10 changes: 10 additions & 0 deletions spec/project_spec.rb
Expand Up @@ -27,6 +27,16 @@
end
end

it 'requires a nicely formatted `VersionAdded` metadata for all cops' do
cop_names.each do |name|
version = config[name]['VersionAdded']
expect(version.nil?).to(be(false),
"VersionAdded is required for #{name}.")
expect(version).to(match(/\A\d+\.\d+\z/),
"#{version} should be format ('X.Y') for #{name}.")
end
end

it 'have a period at EOL of description' do
cop_names.each do |name|
description = config[name]['Description']
Expand Down

0 comments on commit bf9fc25

Please sign in to comment.