Skip to content
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

Enable Migration/DepartmentName cop by default #7723

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -32,6 +32,7 @@
* Add the method name to highlight area of `Layout/EmptyLineBetweenDefs` to help provide more context. ([@rrosenblum][])
* [#7652](https://github.com/rubocop-hq/rubocop/pull/7652): Allow `pp` to allowed names of `Naming/MethodParameterName` cop in default config. ([@masarakki][])
* [#7309](https://github.com/rubocop-hq/rubocop/pull/7309): Mark `Lint/UselessSetterCall` an "not safe" and improve documentation. ([@jonas054][])
* [#7723](https://github.com/rubocop-hq/rubocop/pull/7723): Enable `Migration/DepartmentName` cop by default. ([@koic][])

## 0.79.0 (2020-01-06)

Expand Down
2 changes: 1 addition & 1 deletion config/default.yml
Expand Up @@ -1887,7 +1887,7 @@ Migration/DepartmentName:
Description: >-
Check that cop names in rubocop:disable (etc) comments are
given with department name.
Enabled: false
Enabled: true

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

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
--- | --- | --- | --- | ---
Disabled | Yes | Yes | - | -
Enabled | Yes | Yes | - | -

Check that cop names in rubocop:disable comments are given with
department name.
6 changes: 6 additions & 0 deletions spec/rubocop/cli/cli_auto_gen_config_spec.rb
Expand Up @@ -368,6 +368,12 @@ def f
' Exclude:',
" - 'example1.rb'",
'',
'# Offense count: 2',
'# Cop supports --auto-correct.',
'Migration/DepartmentName:',
' Exclude:',
" - 'example1.rb'",
'',
'# Offense count: 1',
'# Cop supports --auto-correct.',
'# Configuration parameters: EnforcedStyle.',
Expand Down
7 changes: 6 additions & 1 deletion spec/rubocop/cli/cli_options_spec.rb
Expand Up @@ -464,10 +464,11 @@ class SomeCop < Cop
1 Layout/SpaceAroundOperators
1 Layout/Tab
1 Layout/TrailingWhitespace
1 Migration/DepartmentName
1 Style/FrozenStringLiteralComment
1 Style/NumericPredicate
--
6 Total
7 Total

RESULT
end
Expand Down Expand Up @@ -584,6 +585,7 @@ class SomeCop < Cop
expect($stdout.string).to eq(<<~RESULT)
#{file}:1:1: C: Style/FrozenStringLiteralComment: Missing frozen string literal comment.
#{file}:1:8: W: Lint/RedundantCopDisableDirective: Unnecessary disabling of `Style/NumericLiterals`.
#{file}:1:26: C: Migration/DepartmentName: Department name is missing.
#{file}:1:41: C: Layout/TrailingWhitespace: Trailing whitespace detected.
RESULT
end
Expand All @@ -595,6 +597,7 @@ class SomeCop < Cop
expect($stdout.string).to eq(<<~RESULT)
#{file}:1:1: C: Missing frozen string literal comment.
#{file}:1:8: W: Unnecessary disabling of `Style/NumericLiterals`.
#{file}:1:26: C: Department name is missing.
#{file}:1:41: C: Trailing whitespace detected.
RESULT
end
Expand All @@ -614,6 +617,7 @@ class SomeCop < Cop
expect($stdout.string).to eq(<<~RESULT)
#{file}:1:1: C: Style/FrozenStringLiteralComment: Missing frozen string literal comment.
#{file}:1:8: W: Lint/RedundantCopDisableDirective: Unnecessary disabling of `Style/NumericLiterals`.
#{file}:1:26: C: Migration/DepartmentName: Department name is missing.
#{file}:1:41: C: Layout/TrailingWhitespace: Trailing whitespace detected.
RESULT
end
Expand All @@ -624,6 +628,7 @@ class SomeCop < Cop
expect($stdout.string).to eq(<<~RESULT)
#{file}:1:1: C: Missing frozen string literal comment.
#{file}:1:8: W: Unnecessary disabling of `Style/NumericLiterals`.
#{file}:1:26: C: Department name is missing.
#{file}:1:41: C: Trailing whitespace detected.
RESULT
end
Expand Down
2 changes: 2 additions & 0 deletions spec/rubocop/cli_spec.rb
Expand Up @@ -353,7 +353,9 @@ def and_with_args
OUTPUT
expect($stdout.string)
.to eq(<<~RESULT)
#{abs('example.rb')}:3:110: C: Migration/DepartmentName: Department name is missing.
#{abs('example.rb')}:4:81: C: Layout/LineLength: Line is too long. [95/80]
#{abs('example.rb')}:5:28: C: Migration/DepartmentName: Department name is missing.
RESULT
end
end
Expand Down