Commit 3c2d0cf2 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'complexity/enable-multiple-rubocop-cops-2' into 'master'

Enable multiple compatible Rubocop cops

## What does this MR do?

This MR enables multiple Rubocop cops, that are already compatible with
our codebase. See #17406.

Cops enabled:

```text
Style/ArrayJoin:
  Description: Use Array#join instead of Array#*.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#array-join
----------------
Style/Attr:
  Description: Checks for uses of Module#attr.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr
----------------
Style/BlockComments:
  Description: Do not use block comments.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-block-comments
----------------
Style/ClassMethods:
  Description: Use self when defining module/class methods.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#def-self-class-methods
----------------
Style/EndBlock:
  Description: Avoid the use of END blocks.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-END-blocks
----------------
Style/EvenOdd:
  Description: Favor the use of Fixnum#even? && Fixnum#odd?
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods
----------------
Style/FileName:
  Description: Use snake_case for source file names.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
  ExpectMatchingDefinition: false
----------------
Style/FirstMethodParameterLineBreak:
  Description: Checks for a line break before the first parameter in a multi-line method
    parameter definition.
----------------
Style/FlipFlop:
  Description: Checks for flip flops
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-flip-flops
----------------
Style/GlobalVars:
  Description: Do not introduce global variables.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#instance-vars
  Reference: http://www.zenspider.com/Languages/Ruby/QuickRef.html
----------------
Style/IfWithSemicolon:
  Description: Do not use if x; .... Use the ternary operator instead.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs
----------------
Style/LambdaCall:
  Description: Use lambda.call(...) instead of lambda.(...).
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc-call
  EnforcedStyle: call
----------------
Style/MethodName:
  Description: Use the configured style when naming methods.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars
  EnforcedStyle: snake_case
----------------
Style/MultilineMethodDefinitionBraceLayout:
  Description: Checks that the closing brace in a method definition is symmetrical with
    respect to the opening brace and the method parameters.
----------------
Style/NestedModifier:
  Description: Avoid using nested modifiers.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-modifiers
----------------
Style/OpMethod:
  Description: When defining binary operators, name the argument other.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#other-arg
----------------
Style/SignalException:
  Description: Checks for proper usage of fail and raise.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-raise-over-fail
  EnforcedStyle: only_raise
----------------
Style/SpaceAfterNot:
  Description: Tracks redundant space after the ! operator.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-space-bang
----------------
Style/SpaceBeforeSemicolon:
  Description: No spaces before semicolons.
----------------
Style/SpaceInsideRangeLiteral:
  Description: No spaces inside range literals.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals
----------------
Style/SpaceInsideStringInterpolation:
  Description: Checks for padding/surrounding spaces inside string interpolation.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#string-interpolation
  EnforcedStyle: no_space
----------------
Style/StabbyLambdaParentheses:
  Description: Check for the usage of parentheses around stabby lambda arguments.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#stabby-lambda-with-args
  EnforcedStyle: require_parentheses
----------------
Style/StringMethods:
  Description: Checks if configured preferred methods are used over non-preferred.
  PreferredMethods:
    intern: to_sym
----------------
Style/VariableInterpolation:
  Description: Don't interpolate global, instance and class variables directly in strings.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
----------------
Style/VariableName:
  Description: Use the configured style when naming variables.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars
  EnforcedStyle: snake_case
----------------
Style/WhenThen:
  Description: Use when x then ... for one-line cases.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
----------------
Style/WhileUntilModifier:
  Description: Favor modifier while/until usage when you have a single-line body.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier
  MaxLineLength: 80
```

Closes #17406 

See merge request !4286
parents b21e234b 501a2d12
...@@ -59,7 +59,7 @@ Style/AndOr: ...@@ -59,7 +59,7 @@ Style/AndOr:
# Use `Array#join` instead of `Array#*`. # Use `Array#join` instead of `Array#*`.
Style/ArrayJoin: Style/ArrayJoin:
Enabled: false Enabled: true
# Use only ascii symbols in comments. # Use only ascii symbols in comments.
Style/AsciiComments: Style/AsciiComments:
...@@ -71,7 +71,7 @@ Style/AsciiIdentifiers: ...@@ -71,7 +71,7 @@ Style/AsciiIdentifiers:
# Checks for uses of Module#attr. # Checks for uses of Module#attr.
Style/Attr: Style/Attr:
Enabled: false Enabled: true
# Avoid the use of BEGIN blocks. # Avoid the use of BEGIN blocks.
Style/BeginBlock: Style/BeginBlock:
...@@ -83,7 +83,7 @@ Style/BarePercentLiterals: ...@@ -83,7 +83,7 @@ Style/BarePercentLiterals:
# Do not use block comments. # Do not use block comments.
Style/BlockComments: Style/BlockComments:
Enabled: false Enabled: true
# Put end statement of multiline block on its own line. # Put end statement of multiline block on its own line.
Style/BlockEndNewline: Style/BlockEndNewline:
...@@ -124,7 +124,7 @@ Style/ClassCheck: ...@@ -124,7 +124,7 @@ Style/ClassCheck:
# Use self when defining module/class methods. # Use self when defining module/class methods.
Style/ClassMethods: Style/ClassMethods:
Enabled: false Enabled: true
# Avoid the use of class variables. # Avoid the use of class variables.
Style/ClassVars: Style/ClassVars:
...@@ -218,7 +218,7 @@ Style/EmptyLiteral: ...@@ -218,7 +218,7 @@ Style/EmptyLiteral:
# Avoid the use of END blocks. # Avoid the use of END blocks.
Style/EndBlock: Style/EndBlock:
Enabled: false Enabled: true
# Use Unix-style line endings. # Use Unix-style line endings.
Style/EndOfLine: Style/EndOfLine:
...@@ -226,7 +226,7 @@ Style/EndOfLine: ...@@ -226,7 +226,7 @@ Style/EndOfLine:
# Favor the use of Fixnum#even? && Fixnum#odd? # Favor the use of Fixnum#even? && Fixnum#odd?
Style/EvenOdd: Style/EvenOdd:
Enabled: false Enabled: true
# Do not use unnecessary spacing. # Do not use unnecessary spacing.
Style/ExtraSpacing: Style/ExtraSpacing:
...@@ -234,11 +234,16 @@ Style/ExtraSpacing: ...@@ -234,11 +234,16 @@ Style/ExtraSpacing:
# Use snake_case for source file names. # Use snake_case for source file names.
Style/FileName: Style/FileName:
Enabled: false Enabled: true
# Checks for a line break before the first parameter in a multi-line method
# parameter definition.
Style/FirstMethodParameterLineBreak:
Enabled: true
# Checks for flip flops. # Checks for flip flops.
Style/FlipFlop: Style/FlipFlop:
Enabled: false Enabled: true
# Checks use of for or each in multiline loops. # Checks use of for or each in multiline loops.
Style/For: Style/For:
...@@ -250,7 +255,7 @@ Style/FormatString: ...@@ -250,7 +255,7 @@ Style/FormatString:
# Do not introduce global variables. # Do not introduce global variables.
Style/GlobalVars: Style/GlobalVars:
Enabled: false Enabled: true
# Check for conditionals that can be replaced with guard clauses. # Check for conditionals that can be replaced with guard clauses.
Style/GuardClause: Style/GuardClause:
...@@ -271,7 +276,7 @@ Style/IfUnlessModifier: ...@@ -271,7 +276,7 @@ Style/IfUnlessModifier:
# Do not use if x; .... Use the ternary operator instead. # Do not use if x; .... Use the ternary operator instead.
Style/IfWithSemicolon: Style/IfWithSemicolon:
Enabled: false Enabled: true
# Checks that conditional statements do not have an identical line at the # Checks that conditional statements do not have an identical line at the
# end of each branch, which can validly be moved out of the conditional. # end of each branch, which can validly be moved out of the conditional.
...@@ -309,7 +314,7 @@ Style/Lambda: ...@@ -309,7 +314,7 @@ Style/Lambda:
# Use lambda.call(...) instead of lambda.(...). # Use lambda.call(...) instead of lambda.(...).
Style/LambdaCall: Style/LambdaCall:
Enabled: false Enabled: true
# Comments should start with a space. # Comments should start with a space.
Style/LeadingCommentSpace: Style/LeadingCommentSpace:
...@@ -329,7 +334,7 @@ Style/MethodDefParentheses: ...@@ -329,7 +334,7 @@ Style/MethodDefParentheses:
# Use the configured style when naming methods. # Use the configured style when naming methods.
Style/MethodName: Style/MethodName:
Enabled: false Enabled: true
# Checks for usage of `extend self` in modules. # Checks for usage of `extend self` in modules.
Style/ModuleFunction: Style/ModuleFunction:
...@@ -370,6 +375,11 @@ Style/MultilineMethodCallBraceLayout: ...@@ -370,6 +375,11 @@ Style/MultilineMethodCallBraceLayout:
Style/MultilineMethodCallIndentation: Style/MultilineMethodCallIndentation:
Enabled: false Enabled: false
# Checks that the closing brace in a method definition is symmetrical with
# respect to the opening brace and the method parameters.
Style/MultilineMethodDefinitionBraceLayout:
Enabled: false
# Checks indentation of binary operations that span more than one line. # Checks indentation of binary operations that span more than one line.
Style/MultilineOperationIndentation: Style/MultilineOperationIndentation:
Enabled: false Enabled: false
...@@ -392,7 +402,7 @@ Style/NegatedWhile: ...@@ -392,7 +402,7 @@ Style/NegatedWhile:
# Avoid using nested modifiers. # Avoid using nested modifiers.
Style/NestedModifier: Style/NestedModifier:
Enabled: false Enabled: true
# Parenthesize method calls which are nested inside the argument list of # Parenthesize method calls which are nested inside the argument list of
# another parenthesized method call. # another parenthesized method call.
...@@ -429,7 +439,7 @@ Style/OneLineConditional: ...@@ -429,7 +439,7 @@ Style/OneLineConditional:
# When defining binary operators, name the argument other. # When defining binary operators, name the argument other.
Style/OpMethod: Style/OpMethod:
Enabled: false Enabled: true
# Check for simple usages of parallel assignment. It will only warn when # Check for simple usages of parallel assignment. It will only warn when
# the number of variables matches on both sides of the assignment. # the number of variables matches on both sides of the assignment.
...@@ -509,7 +519,8 @@ Style/Semicolon: ...@@ -509,7 +519,8 @@ Style/Semicolon:
# Checks for proper usage of fail and raise. # Checks for proper usage of fail and raise.
Style/SignalException: Style/SignalException:
Enabled: false EnforcedStyle: only_raise
Enabled: true
# Enforces the names of some block params. # Enforces the names of some block params.
Style/SingleLineBlockParams: Style/SingleLineBlockParams:
...@@ -534,11 +545,11 @@ Style/SpaceAfterMethodName: ...@@ -534,11 +545,11 @@ Style/SpaceAfterMethodName:
# Tracks redundant space after the ! operator. # Tracks redundant space after the ! operator.
Style/SpaceAfterNot: Style/SpaceAfterNot:
Enabled: false Enabled: true
# Use spaces after semicolons. # Use spaces after semicolons.
Style/SpaceAfterSemicolon: Style/SpaceAfterSemicolon:
Enabled: false Enabled: true
# Checks that the equals signs in parameter default assignments have or don't # Checks that the equals signs in parameter default assignments have or don't
# have surrounding space depending on configuration. # have surrounding space depending on configuration.
...@@ -572,7 +583,7 @@ Style/SpaceBeforeFirstArg: ...@@ -572,7 +583,7 @@ Style/SpaceBeforeFirstArg:
# No spaces before semicolons. # No spaces before semicolons.
Style/SpaceBeforeSemicolon: Style/SpaceBeforeSemicolon:
Enabled: false Enabled: true
# Checks that block braces have or don't have surrounding space. # Checks that block braces have or don't have surrounding space.
# For blocks taking parameters, checks that the left brace has or doesn't # For blocks taking parameters, checks that the left brace has or doesn't
...@@ -594,11 +605,12 @@ Style/SpaceInsideParens: ...@@ -594,11 +605,12 @@ Style/SpaceInsideParens:
# No spaces inside range literals. # No spaces inside range literals.
Style/SpaceInsideRangeLiteral: Style/SpaceInsideRangeLiteral:
Enabled: false Enabled: true
# Checks for padding/surrounding spaces inside string interpolation. # Checks for padding/surrounding spaces inside string interpolation.
Style/SpaceInsideStringInterpolation: Style/SpaceInsideStringInterpolation:
Enabled: false EnforcedStyle: no_space
Enabled: true
# Avoid Perl-style global variables. # Avoid Perl-style global variables.
Style/SpecialGlobalVars: Style/SpecialGlobalVars:
...@@ -606,7 +618,8 @@ Style/SpecialGlobalVars: ...@@ -606,7 +618,8 @@ Style/SpecialGlobalVars:
# Check for the usage of parentheses around stabby lambda arguments. # Check for the usage of parentheses around stabby lambda arguments.
Style/StabbyLambdaParentheses: Style/StabbyLambdaParentheses:
Enabled: false EnforcedStyle: require_parentheses
Enabled: true
# Checks if uses of quotes match the configured preference. # Checks if uses of quotes match the configured preference.
Style/StringLiterals: Style/StringLiterals:
...@@ -619,7 +632,9 @@ Style/StringLiteralsInInterpolation: ...@@ -619,7 +632,9 @@ Style/StringLiteralsInInterpolation:
# Checks if configured preferred methods are used over non-preferred. # Checks if configured preferred methods are used over non-preferred.
Style/StringMethods: Style/StringMethods:
Enabled: false PreferredMethods:
intern: to_sym
Enabled: true
# Use %i or %I for arrays of symbols. # Use %i or %I for arrays of symbols.
Style/SymbolArray: Style/SymbolArray:
...@@ -677,15 +692,16 @@ Style/UnneededPercentQ: ...@@ -677,15 +692,16 @@ Style/UnneededPercentQ:
# Don't interpolate global, instance and class variables directly in strings. # Don't interpolate global, instance and class variables directly in strings.
Style/VariableInterpolation: Style/VariableInterpolation:
Enabled: false Enabled: true
# Use the configured style when naming variables. # Use the configured style when naming variables.
Style/VariableName: Style/VariableName:
Enabled: false EnforcedStyle: snake_case
Enabled: true
# Use when x then ... for one-line cases. # Use when x then ... for one-line cases.
Style/WhenThen: Style/WhenThen:
Enabled: false Enabled: true
# Checks for redundant do after while or until. # Checks for redundant do after while or until.
Style/WhileUntilDo: Style/WhileUntilDo:
...@@ -693,7 +709,7 @@ Style/WhileUntilDo: ...@@ -693,7 +709,7 @@ Style/WhileUntilDo:
# Favor modifier while/until usage when you have a single-line body. # Favor modifier while/until usage when you have a single-line body.
Style/WhileUntilModifier: Style/WhileUntilModifier:
Enabled: false Enabled: true
# Use %w or %W for arrays of words. # Use %w or %W for arrays of words.
Style/WordArray: Style/WordArray:
......
module Ci module Ci
class GitlabCiYamlProcessor class GitlabCiYamlProcessor
class ValidationError < StandardError;end class ValidationError < StandardError; end
DEFAULT_STAGES = %w(build test deploy) DEFAULT_STAGES = %w(build test deploy)
DEFAULT_STAGE = 'test' DEFAULT_STAGE = 'test'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment