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

[Fix #7077] Rename cops to meet the cop naming guideline #10725

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/change_cops_names_to_meet_naming_guideline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#7077](https://github.com/rubocop/rubocop/issues/7077): Rename Layout/IndentationConsistency, Lint/PercentStringArray, Lint/PercentSymbolArray, Naming/VariableNumber, Style/DefWithParentheses to meet the naming guideline. ([@pirj][])
100 changes: 50 additions & 50 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ Layout/HeredocIndentation:
VersionAdded: '0.49'
VersionChanged: '0.85'

Layout/IndentationConsistency:
Layout/InconsistentIndentation:
Description: 'Keep indentation straight.'
StyleGuide: '#spaces-indentation'
Enabled: true
Expand Down Expand Up @@ -1638,13 +1638,6 @@ Lint/DeprecatedOpenSSLConstant:
Enabled: true
VersionAdded: '0.84'

Lint/DisjunctiveAssignmentInConstructor:
Description: 'In constructor, plain assignment is preferred over disjunctive.'
Enabled: true
Safe: false
VersionAdded: '0.62'
VersionChanged: '0.88'

Lint/DuplicateBranch:
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
Enabled: pending
Expand Down Expand Up @@ -1963,6 +1956,13 @@ Lint/NumberedParameterAssignment:
Enabled: pending
VersionAdded: '1.9'

Lint/OrAssignmentInConstructor:
Description: 'Checks constructors for or-assignments to instance variables.'
Enabled: true
Safe: false
VersionAdded: '0.62'
VersionChanged: '0.88'

Lint/OrAssignmentToConstant:
Description: 'Checks unintended or-assignment to constant.'
Enabled: pending
Expand All @@ -1989,19 +1989,6 @@ Lint/ParenthesesAsGroupedExpression:
VersionAdded: '0.12'
VersionChanged: '0.83'

Lint/PercentStringArray:
Description: >-
Checks for unwanted commas and quotes in %w/%W literals.
Enabled: true
Safe: false
VersionAdded: '0.41'

Lint/PercentSymbolArray:
Description: >-
Checks for unwanted commas and colons in %i/%I literals.
Enabled: true
VersionAdded: '0.41'

Lint/RaiseException:
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
StyleGuide: '#raise-exception'
Expand Down Expand Up @@ -2039,6 +2026,19 @@ Lint/RedundantDirGlobSort:
VersionChanged: '1.26'
SafeAutoCorrect: false

Lint/RedundantPercentIPunctuation:
Description: >-
Checks for unwanted commas and colons in %i/%I literals.
Enabled: true
VersionAdded: '0.41'

Lint/RedundantPercentWPunctuation:
Description: >-
Checks for unwanted commas and quotes in %w/%W literals.
Enabled: true
Safe: false
VersionAdded: '0.41'

Lint/RedundantRequireStatement:
Description: 'Checks for unnecessary `require` statement.'
Enabled: true
Expand Down Expand Up @@ -2745,6 +2745,28 @@ Naming/MethodParameterName:
# Forbidden names that will register an offense
ForbiddenNames: []

Naming/NumericVariableSuffix:
Description: 'Use the configured style when numbering symbols, methods and variables.'
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
Enabled: true
VersionAdded: '0.50'
VersionChanged: '1.4'
EnforcedStyle: normalcase
SupportedStyles:
- snake_case
- normalcase
- non_integer
CheckMethodNames: true
CheckSymbols: true
AllowedIdentifiers:
- capture3 # Open3.capture3
- iso8601 # Time#iso8601
- rfc1123_date # CGI.rfc1123_date
- rfc822 # Time#rfc822
- rfc2822 # Time#rfc2822
- rfc3339 # DateTime.rfc3339
AllowedPatterns: []

Naming/PredicateName:
Description: 'Check the names of predicate methods.'
StyleGuide: '#bool-methods-qmark'
Expand Down Expand Up @@ -2794,28 +2816,6 @@ Naming/VariableName:
AllowedIdentifiers: []
AllowedPatterns: []

Naming/VariableNumber:
Description: 'Use the configured style when numbering symbols, methods and variables.'
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
Enabled: true
VersionAdded: '0.50'
VersionChanged: '1.4'
EnforcedStyle: normalcase
SupportedStyles:
- snake_case
- normalcase
- non_integer
CheckMethodNames: true
CheckSymbols: true
AllowedIdentifiers:
- capture3 # Open3.capture3
- iso8601 # Time#iso8601
- rfc1123_date # CGI.rfc1123_date
- rfc822 # Time#rfc822
- rfc2822 # Time#rfc2822
- rfc3339 # DateTime.rfc3339
AllowedPatterns: []

#################### Security ##############################

Security/CompoundHash:
Expand Down Expand Up @@ -3367,13 +3367,6 @@ Style/DateTime:
SafeAutoCorrect: false
AllowCoercion: false

Style/DefWithParentheses:
Description: 'Use def with parentheses when there are arguments.'
StyleGuide: '#method-parens'
Enabled: true
VersionAdded: '0.9'
VersionChanged: '0.12'

Style/Dir:
Description: >-
Use the `__dir__` method to retrieve the canonicalized
Expand Down Expand Up @@ -4614,6 +4607,13 @@ Style/RedundantInterpolation:
VersionAdded: '0.76'
VersionChanged: '1.30'

Style/RedundantMethodDefParentheses:
Description: 'Use def with parentheses when there are arguments.'
StyleGuide: '#method-parens'
Enabled: true
VersionAdded: '0.9'
VersionChanged: '0.12'

Style/RedundantParentheses:
Description: "Checks for parentheses that seem not to serve any purpose."
Enabled: true
Expand Down
8 changes: 6 additions & 2 deletions config/obsoletion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ renamed:
Layout/AlignArray: Layout/ArrayAlignment
Layout/AlignHash: Layout/HashAlignment
Layout/AlignParameters: Layout/ParameterAlignment
Layout/IndentationConsistency: Layout/InconsistentIndentation
Layout/IndentArray: Layout/FirstArrayElementIndentation
Layout/IndentAssignment: Layout/AssignmentIndentation
Layout/IndentFirstArgument: Layout/FirstArgumentIndentation
Expand All @@ -25,6 +26,7 @@ renamed:
Lint/Eval: Security/Eval
Lint/HandleExceptions: Lint/SuppressedException
Lint/MultipleCompare: Lint/MultipleComparison
Lint/PercentStringArray: Lint/RedundantPercentWPunctuation
Lint/StringConversionInInterpolation: Lint/RedundantStringCoercion
Lint/UnneededCopDisableDirective: Lint/RedundantCopDisableDirective
Lint/UnneededCopEnableDirective: Lint/RedundantCopEnableDirective
Expand All @@ -33,10 +35,12 @@ renamed:
Metrics/LineLength: Layout/LineLength
Naming/UncommunicativeBlockParamName: Naming/BlockParameterName
Naming/UncommunicativeMethodParamName: Naming/MethodParameterName
Naming/VariableNumber: Naming/NumericVariableSuffix
Style/AccessorMethodName: Naming/AccessorMethodName
Style/AsciiIdentifiers: Naming/AsciiIdentifiers
Style/ClassAndModuleCamelCase: Naming/ClassAndModuleCamelCase
Style/ConstantName: Naming/ConstantName
Style/DefWithParentheses: Style/RedundantMethodDefParentheses
Style/DeprecatedHashMethods: Style/PreferredHashMethods
Style/FileName: Naming/FileName
Style/FlipFlop: Lint/FlipFlop
Expand All @@ -51,7 +55,7 @@ renamed:
Style/UnneededPercentQ: Style/RedundantPercentQ
Style/UnneededSort: Style/RedundantSort
Style/VariableName: Naming/VariableName
Style/VariableNumber: Naming/VariableNumber
Style/VariableNumber: Naming/NumericVariableSuffix

# Cops that were removed
removed:
Expand Down Expand Up @@ -203,7 +207,7 @@ changed_parameters:

# Enforced styles that have been removed or replaced
changed_enforced_styles:
- cops: Layout/IndentationConsistency
- cops: Layout/InconsistentIndentation
parameters: EnforcedStyle
value: rails
alternative: indented_internal_methods
13 changes: 7 additions & 6 deletions docs/modules/ROOT/pages/cops.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ In the following section you find all available cops:
* xref:cops_layout.adoc#layouthashalignment[Layout/HashAlignment]
* xref:cops_layout.adoc#layoutheredocargumentclosingparenthesis[Layout/HeredocArgumentClosingParenthesis]
* xref:cops_layout.adoc#layoutheredocindentation[Layout/HeredocIndentation]
* xref:cops_layout.adoc#layoutindentationconsistency[Layout/IndentationConsistency]
* xref:cops_layout.adoc#layoutinconsistentindentation[Layout/InconsistentIndentation]
* xref:cops_layout.adoc#layoutindentationstyle[Layout/IndentationStyle]
* xref:cops_layout.adoc#layoutindentationwidth[Layout/IndentationWidth]
* xref:cops_layout.adoc#layoutinitialindentation[Layout/InitialIndentation]
Expand Down Expand Up @@ -209,7 +209,6 @@ In the following section you find all available cops:
* xref:cops_lint.adoc#lintdeprecatedclassmethods[Lint/DeprecatedClassMethods]
* xref:cops_lint.adoc#lintdeprecatedconstants[Lint/DeprecatedConstants]
* xref:cops_lint.adoc#lintdeprecatedopensslconstant[Lint/DeprecatedOpenSSLConstant]
* xref:cops_lint.adoc#lintdisjunctiveassignmentinconstructor[Lint/DisjunctiveAssignmentInConstructor]
* xref:cops_lint.adoc#lintduplicatebranch[Lint/DuplicateBranch]
* xref:cops_lint.adoc#lintduplicatecasecondition[Lint/DuplicateCaseCondition]
* xref:cops_lint.adoc#lintduplicateelsifcondition[Lint/DuplicateElsifCondition]
Expand Down Expand Up @@ -259,17 +258,18 @@ In the following section you find all available cops:
* xref:cops_lint.adoc#lintnonlocalexitfromiterator[Lint/NonLocalExitFromIterator]
* xref:cops_lint.adoc#lintnumberconversion[Lint/NumberConversion]
* xref:cops_lint.adoc#lintnumberedparameterassignment[Lint/NumberedParameterAssignment]
* xref:cops_lint.adoc#lintorassignmentinconstructor[Lint/OrAssignmentInConstructor]
* xref:cops_lint.adoc#lintorassignmenttoconstant[Lint/OrAssignmentToConstant]
* xref:cops_lint.adoc#lintorderedmagiccomments[Lint/OrderedMagicComments]
* xref:cops_lint.adoc#lintoutofrangeregexpref[Lint/OutOfRangeRegexpRef]
* xref:cops_lint.adoc#lintparenthesesasgroupedexpression[Lint/ParenthesesAsGroupedExpression]
* xref:cops_lint.adoc#lintpercentstringarray[Lint/PercentStringArray]
* xref:cops_lint.adoc#lintpercentsymbolarray[Lint/PercentSymbolArray]
* xref:cops_lint.adoc#lintraiseexception[Lint/RaiseException]
* xref:cops_lint.adoc#lintrandone[Lint/RandOne]
* xref:cops_lint.adoc#lintredundantcopdisabledirective[Lint/RedundantCopDisableDirective]
* xref:cops_lint.adoc#lintredundantcopenabledirective[Lint/RedundantCopEnableDirective]
* xref:cops_lint.adoc#lintredundantdirglobsort[Lint/RedundantDirGlobSort]
* xref:cops_lint.adoc#lintredundantpercentipunctuation[Lint/RedundantPercentIPunctuation]
* xref:cops_lint.adoc#lintredundantpercentwpunctuation[Lint/RedundantPercentWPunctuation]
* xref:cops_lint.adoc#lintredundantrequirestatement[Lint/RedundantRequireStatement]
* xref:cops_lint.adoc#lintredundantsafenavigation[Lint/RedundantSafeNavigation]
* xref:cops_lint.adoc#lintredundantsplatexpansion[Lint/RedundantSplatExpansion]
Expand Down Expand Up @@ -313,6 +313,7 @@ In the following section you find all available cops:
* xref:cops_lint.adoc#linturiregexp[Lint/UriRegexp]
* xref:cops_lint.adoc#lintuselessaccessmodifier[Lint/UselessAccessModifier]
* xref:cops_lint.adoc#lintuselessassignment[Lint/UselessAssignment]
* xref:cops_lint.adoc#lintuselesselsewithoutrescue[Lint/UselessElseWithoutRescue]
* xref:cops_lint.adoc#lintuselessmethoddefinition[Lint/UselessMethodDefinition]
* xref:cops_lint.adoc#lintuselessruby2keywords[Lint/UselessRuby2Keywords]
* xref:cops_lint.adoc#lintuselesssettercall[Lint/UselessSetterCall]
Expand Down Expand Up @@ -351,10 +352,10 @@ In the following section you find all available cops:
* xref:cops_naming.adoc#namingmemoizedinstancevariablename[Naming/MemoizedInstanceVariableName]
* xref:cops_naming.adoc#namingmethodname[Naming/MethodName]
* xref:cops_naming.adoc#namingmethodparametername[Naming/MethodParameterName]
* xref:cops_naming.adoc#namingnumericvariablesuffix[Naming/NumericVariableSuffix]
* xref:cops_naming.adoc#namingpredicatename[Naming/PredicateName]
* xref:cops_naming.adoc#namingrescuedexceptionsvariablename[Naming/RescuedExceptionsVariableName]
* xref:cops_naming.adoc#namingvariablename[Naming/VariableName]
* xref:cops_naming.adoc#namingvariablenumber[Naming/VariableNumber]

=== Department xref:cops_security.adoc[Security]

Expand Down Expand Up @@ -404,7 +405,6 @@ In the following section you find all available cops:
* xref:cops_style.adoc#styleconstantvisibility[Style/ConstantVisibility]
* xref:cops_style.adoc#stylecopyright[Style/Copyright]
* xref:cops_style.adoc#styledatetime[Style/DateTime]
* xref:cops_style.adoc#styledefwithparentheses[Style/DefWithParentheses]
* xref:cops_style.adoc#styledir[Style/Dir]
* xref:cops_style.adoc#styledisablecopswithinsourcecodedirective[Style/DisableCopsWithinSourceCodeDirective]
* xref:cops_style.adoc#styledocumentdynamicevaldefinition[Style/DocumentDynamicEvalDefinition]
Expand Down Expand Up @@ -533,6 +533,7 @@ In the following section you find all available cops:
* xref:cops_style.adoc#styleredundantfreeze[Style/RedundantFreeze]
* xref:cops_style.adoc#styleredundantinitialize[Style/RedundantInitialize]
* xref:cops_style.adoc#styleredundantinterpolation[Style/RedundantInterpolation]
* xref:cops_style.adoc#styleredundantmethoddefparentheses[Style/RedundantMethodDefParentheses]
* xref:cops_style.adoc#styleredundantparentheses[Style/RedundantParentheses]
* xref:cops_style.adoc#styleredundantpercentq[Style/RedundantPercentQ]
* xref:cops_style.adoc#styleredundantregexpcharacterclass[Style/RedundantRegexpCharacterClass]
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/pages/cops_layout.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ Checks the indentation of the first line of the
right-hand-side of a multi-line assignment.

The indentation of the remaining lines can be corrected with
other cops such as `IndentationConsistency` and `EndAlignment`.
other cops such as `InconsistentIndentation` and `EndAlignment`.

=== Examples

Expand Down Expand Up @@ -3511,7 +3511,7 @@ RUBY

* https://rubystyle.guide#squiggly-heredocs

== Layout/IndentationConsistency
== Layout/InconsistentIndentation

|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
Expand Down Expand Up @@ -3748,7 +3748,7 @@ end
Checks for indentation that doesn't use the specified number
of spaces.

See also the IndentationConsistency cop which is the companion to this
See also the Layout/InconsistentIndentation cop which is the companion to this
one.

=== Examples
Expand Down
Loading