Commit 47e1a777 authored by Gabriel Mazetto's avatar Gabriel Mazetto 🚀

Updated Rubocop definitions to work with 0.59.x

There is also a workaround to enable rubocop support integration on
a variety of code editors. As `gdk-rubocop.yml` is not a standard
file, many editors will just ignore it and run rubocop with defaults.

Because we only have ruby code in a few folders, we can add a
`.rubocop.yml` file on these folders and inherit from `gdk-rubocop.yml`.

We can't just rename `gdk-rubocop.yml` as this would interfere with the
configuration file inside the `gitlab` folder.
parent 2c779c0d
......@@ -9,7 +9,7 @@ engines:
enabled: false
rubocop:
enabled: true
channel: rubocop-0-49
channel: rubocop-0-59
config:
file: gdk-rubocop.yml
shellcheck:
......
......@@ -10,17 +10,13 @@ variables:
DOCKER_DRIVER: overlay
TEST_IMAGE: registry.gitlab.com/gitlab-org/gitlab-development-kit:latest
codequality:
code_quality:
image: docker:stable
variables:
DOCKER_DRIVER: overlay2
allow_failure: true
before_script: []
cache: {}
dependencies: []
tags: []
services:
- docker:stable-dind
variables:
DOCKER_DRIVER: overlay2
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
......@@ -29,8 +25,8 @@ codequality:
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths:
- codeclimate.json
reports:
codequality: [gl-code-quality-report.json]
container_scanning:
image: docker:stable
......
......@@ -25,12 +25,46 @@ AllCops:
Bundler/OrderedGems:
Enabled: false
# Style #######################################################################
# Naming ######################################################################
# Check the naming of accessor methods for get_/set_.
Style/AccessorMethodName:
Naming/AccessorMethodName:
Enabled: false
# Use only ascii symbols in identifiers.
Naming/AsciiIdentifiers:
Enabled: true
# Use CamelCase for classes and modules.'
Naming/ClassAndModuleCamelCase:
Enabled: true
# Constants should use SCREAMING_SNAKE_CASE.
Naming/ConstantName:
Enabled: true
# Use snake_case for source file names.
Naming/FileName:
Enabled: true
# Use the configured style when naming methods.
Naming/MethodName:
Enabled: true
# Use the configured style when naming variables.
Naming/VariableName:
EnforcedStyle: snake_case
Enabled: true
# Use the configured style when numbering variables.
Naming/VariableNumber:
Enabled: false
# When defining binary operators, name the argument other.
Naming/BinaryOperatorParameterName:
Enabled: true
# Style #######################################################################
# Use alias_method instead of alias.
Style/Alias:
EnforcedStyle: prefer_alias_method
......@@ -49,10 +83,6 @@ Style/ArrayJoin:
Style/AsciiComments:
Enabled: true
# Use only ascii symbols in identifiers.
Style/AsciiIdentifiers:
Enabled: true
# Checks for uses of Module#attr.
Style/Attr:
Enabled: true
......@@ -83,10 +113,6 @@ Style/CaseEquality:
Style/CharacterLiteral:
Enabled: true
# Use CamelCase for classes and modules.'
Style/ClassAndModuleCamelCase:
Enabled: true
# Checks style of children classes and modules.
Style/ClassAndModuleChildren:
Enabled: false
......@@ -119,10 +145,6 @@ Style/CommentAnnotation:
Style/ConditionalAssignment:
Enabled: true
# Constants should use SCREAMING_SNAKE_CASE.
Style/ConstantName:
Enabled: true
# Use def with parentheses when there are arguments.
Style/DefWithParentheses:
Enabled: true
......@@ -145,10 +167,6 @@ Style/EndBlock:
Style/EvenOdd:
Enabled: true
# Use snake_case for source file names.
Style/FileName:
Enabled: true
# Checks for flip flops.
Style/FlipFlop:
Enabled: true
......@@ -191,10 +209,6 @@ Style/LambdaCall:
Style/MethodDefParentheses:
Enabled: true
# Use the configured style when naming methods.
Style/MethodName:
Enabled: true
# Checks for usage of `extend self` in modules.
Style/ModuleFunction:
Enabled: false
......@@ -248,10 +262,6 @@ Style/NumericLiterals:
Style/OneLineConditional:
Enabled: true
# When defining binary operators, name the argument other.
Style/OpMethod:
Enabled: true
# Don't use parentheses around the condition of an if/unless/while.
Style/ParenthesesAroundCondition:
Enabled: true
......@@ -306,8 +316,13 @@ Style/StringMethods:
intern: to_sym
Enabled: true
# This cop checks for trailing comma in array and hash literals.
Style/TrailingCommaInLiteral:
# This cop checks for trailing comma in array literals.
Style/TrailingCommaInArrayLiteral:
Enabled: true
EnforcedStyleForMultiline: no_comma
# This cop checks for trailing comma in hash literals.
Style/TrailingCommaInHashLiteral:
Enabled: true
EnforcedStyleForMultiline: no_comma
......@@ -328,15 +343,6 @@ Style/UnneededPercentQ:
Style/VariableInterpolation:
Enabled: true
# Use the configured style when naming variables.
Style/VariableName:
EnforcedStyle: snake_case
Enabled: true
# Use the configured style when numbering variables.
Style/VariableNumber:
Enabled: false
# Use when x then ... for one-line cases.
Style/WhenThen:
Enabled: true
......@@ -359,6 +365,22 @@ Style/Proc:
# Layout ######################################################################
# Align ends correctly.
Layout/EndAlignment:
Enabled: true
# Align ends corresponding to defs correctly.
Layout/DefEndAlignment:
Enabled: true
# Checks for condition placed in a confusing position relative to the keyword.
Layout/ConditionPosition:
Enabled: true
# Align block ends correctly.
Layout/BlockAlignment:
Enabled: true
# Check indentation of private/protected visibility modifiers.
Layout/AccessModifierIndentation:
Enabled: true
......@@ -533,10 +555,6 @@ Layout/SpaceBeforeComment:
Layout/SpaceBeforeSemicolon:
Enabled: true
# Checks for spaces inside square brackets.
Layout/SpaceInsideBrackets:
Enabled: true
# Use spaces inside hash literal braces - or don't.
Layout/SpaceInsideHashLiteralBraces:
Enabled: true
......@@ -624,27 +642,15 @@ Lint/AmbiguousRegexpLiteral:
Lint/AssignmentInCondition:
Enabled: false
# Align block ends correctly.
Lint/BlockAlignment:
Enabled: true
# Default values in optional keyword arguments and optional ordinal arguments
# should not refer back to the name of the argument.
Lint/CircularArgumentReference:
Enabled: true
# Checks for condition placed in a confusing position relative to the keyword.
Lint/ConditionPosition:
Enabled: true
# Check for debugger calls.
Lint/Debugger:
Enabled: true
# Align ends corresponding to defs correctly.
Lint/DefEndAlignment:
Enabled: true
# Check for deprecated class method calls.
Lint/DeprecatedClassMethods:
Enabled: true
......@@ -665,10 +671,6 @@ Lint/EmptyEnsure:
Lint/EmptyWhen:
Enabled: true
# Align ends correctly.
Lint/EndAlignment:
Enabled: true
# END blocks should not be placed inside method definitions.
Lint/EndInMethod:
Enabled: true
......@@ -699,13 +701,8 @@ Lint/ImplicitStringConcatenation:
Lint/IneffectiveAccessModifier:
Enabled: false
# Checks for invalid character literals with a non-escaped whitespace
# character.
Lint/InvalidCharacterLiteral:
Enabled: true
# Checks of literals used in conditions.
Lint/LiteralInCondition:
Lint/LiteralAsCondition:
Enabled: true
# Checks for literals used in interpolation.
......@@ -765,7 +762,7 @@ Lint/UnifiedInteger:
# Checks for rubocop:disable comments that can be removed.
# Note: this cop is not disabled when disabling all cops.
# It must be explicitly disabled.
Lint/UnneededDisable:
Lint/UnneededCopDisableDirective:
Enabled: false
# This cop checks for unneeded usages of splat expansion
......
inherit_from: ../gdk-rubocop.yml
\ No newline at end of file
inherit_from: ../gdk-rubocop.yml
\ No newline at end of file
inherit_from: ../gdk-rubocop.yml
\ No newline at end of file
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