diff options
author | Robert Speicher <robert@gitlab.com> | 2016-05-23 19:39:34 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-05-23 19:39:34 +0000 |
commit | c002a560afae7db6a5c778bc78028243c2fc945a (patch) | |
tree | faa75c602cc60661e8062eb3d6e82154d9e74bf0 /.rubocop.yml | |
parent | 18ac02a3fec248a1f2bb3ef5aff30344b8f80d40 (diff) | |
parent | da5943fc9585d9728da1a9c1c43296f838faad37 (diff) | |
download | gitlab-ce-c002a560afae7db6a5c778bc78028243c2fc945a.tar.gz |
Merge branch 'complexity/enable-multiple-rubocop-cops' into 'master'
Enable multiple Rubocop cops that can be enabled
See https://gitlab.com/gitlab-org/gitlab-ce/issues/17406
This enabled following cops:
```text
Lint/CircularArgumentReference:
Description: Default values in optional keyword arguments and optional ordinal arguments
----------------
Lint/ConditionPosition:
Description: Checks for condition placed in a confusing position relative to the keyword.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#same-line-condition
----------------
Lint/Debugger:
Description: Check for debugger calls.
----------------
Lint/DefEndAlignment:
Description: Align ends corresponding to defs correctly.
----------------
Lint/DuplicateMethods:
Description: Check for duplicate method definitions.
----------------
Lint/DuplicatedKey:
Description: Check for duplicate keys in hash literals.
----------------
Lint/EachWithObjectArgument:
Description: Check for immutable argument given to each_with_object.
----------------
Lint/ElseLayout:
Description: Check for odd code arrangement in an else block.
----------------
Lint/EmptyEnsure:
Description: Checks for empty ensure block.
----------------
Lint/EmptyInterpolation:
Description: Checks for empty string interpolation.
----------------
Lint/EndAlignment:
Description: Align ends correctly.
----------------
Lint/EndInMethod:
Description: END blocks should not be placed inside method definitions.
----------------
Lint/EnsureReturn:
Description: Do not use return in an ensure block.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-return-ensure
----------------
Lint/Eval:
Description: The use of eval represents a serious security risk.
----------------
Lint/FloatOutOfRange:
Description: Catches floating-point literals too large or small for Ruby to represent.
----------------
Lint/FormatParameterMismatch:
Description: The number of parameters to format/sprint must match the fields.
----------------
Lint/ImplicitStringConcatenation:
Description: Checks for adjacent string literals on the same line, which could better
be represented as a single string literal.
----------------
Lint/InvalidCharacterLiteral:
Description: Checks for invalid character literals with a non-escaped whitespace character.
----------------
Lint/LiteralInInterpolation:
Description: Checks for literals used in interpolation.
----------------
Lint/NestedMethodDefinition:
Description: Do not use nested method definitions.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-methods
----------------
Lint/NextWithoutAccumulator:
Description: Do not omit the accumulator when calling `next` in a `reduce`/`inject`
block.
----------------
Lint/RandOne:
Description: Checks for `rand(1)` calls. Such calls always return `0` and most likely
a mistake.
----------------
Lint/RequireParentheses:
Description: Use parentheses in the method call to avoid confusion about precedence.
----------------
Lint/UnreachableCode:
Description: Unreachable code.
----------------
Lint/UselessComparison:
Description: Checks for comparison of something with itself.
----------------
Lint/UselessElseWithoutRescue:
Description: Checks for useless `else` in `begin..end` without `rescue`.
----------------
Lint/UselessSetterCall:
Description: Checks for useless setter call to a local variable.
----------------
Lint/Void:
Description: Possible use of operator/literal/variable in void context.
----------------
Performance/DoubleStartEndWith:
Description: Use `str.{start,end}_with?(x, ..., y, ...)` instead of `str.{start,end}_with?(x,
...) || str.{start,end}_with?(y, ...)`.
----------------
Performance/RedundantSortBy:
Description: Use `sort` instead of `sort_by { |x| x }`.
----------------
Rails/FindBy:
Description: Prefer find_by over where.first.
Include:
- app/models/**/*.rb
----------------
Rails/FindEach:
Description: Prefer all.find_each over all.find.
Include:
- app/models/**/*.rb
----------------
Rails/PluralizationGrammar:
Description: Checks for incorrect grammar when using methods like `3.day.ago`.
----------------
Rails/ScopeArgs:
Description: Checks the arguments of ActiveRecord scopes.
Include:
- app/models/**/*.rb
```
See merge request !4261
Diffstat (limited to '.rubocop.yml')
-rw-r--r-- | .rubocop.yml | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index a3caba7068f..03e026ccee9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -772,19 +772,19 @@ Lint/BlockAlignment: # Default values in optional keyword arguments and optional ordinal arguments # should not refer back to the name of the argument. Lint/CircularArgumentReference: - Enabled: false + Enabled: true # Checks for condition placed in a confusing position relative to the keyword. Lint/ConditionPosition: - Enabled: false + Enabled: true # Check for debugger calls. Lint/Debugger: - Enabled: false + Enabled: true # Align ends corresponding to defs correctly. Lint/DefEndAlignment: - Enabled: false + Enabled: true # Check for deprecated class method calls. Lint/DeprecatedClassMethods: @@ -800,15 +800,15 @@ Lint/DuplicatedKey: # Check for immutable argument given to each_with_object. Lint/EachWithObjectArgument: - Enabled: false + Enabled: true # Check for odd code arrangement in an else block. Lint/ElseLayout: - Enabled: false + Enabled: true # Checks for empty ensure block. Lint/EmptyEnsure: - Enabled: false + Enabled: true # Checks for empty string interpolation. Lint/EmptyInterpolation: @@ -816,37 +816,36 @@ Lint/EmptyInterpolation: # Align ends correctly. Lint/EndAlignment: - Enabled: false + Enabled: true # END blocks should not be placed inside method definitions. Lint/EndInMethod: - Enabled: false + Enabled: true # Do not use return in an ensure block. Lint/EnsureReturn: - Enabled: false + Enabled: true # The use of eval represents a serious security risk. Lint/Eval: - Enabled: false + Enabled: true # Catches floating-point literals too large or small for Ruby to represent. Lint/FloatOutOfRange: - Enabled: false + Enabled: true # The number of parameters to format/sprint must match the fields. Lint/FormatParameterMismatch: - Enabled: false + Enabled: true # Don't suppress exception. Lint/HandleExceptions: Enabled: false -# TODO: Enable ImplicitStringConcatenation Cop. # Checks for adjacent string literals on the same line, which could better be # represented as a single string literal. Lint/ImplicitStringConcatenation: - Enabled: false + Enabled: true # TODO: Enable IneffectiveAccessModifier Cop. # Checks for attempts to use `private` or `protected` to set the visibility @@ -857,7 +856,7 @@ Lint/IneffectiveAccessModifier: # Checks for invalid character literals with a non-escaped whitespace # character. Lint/InvalidCharacterLiteral: - Enabled: false + Enabled: true # Checks of literals used in conditions. Lint/LiteralInCondition: @@ -865,7 +864,7 @@ Lint/LiteralInCondition: # Checks for literals used in interpolation. Lint/LiteralInInterpolation: - Enabled: false + Enabled: true # Use Kernel#loop with break rather than begin/end/until or begin/end/while # for post-loop tests. @@ -874,11 +873,11 @@ Lint/Loop: # Do not use nested method definitions. Lint/NestedMethodDefinition: - Enabled: false + Enabled: true # Do not omit the accumulator when calling `next` in a `reduce`/`inject` block. Lint/NextWithoutAccumulator: - Enabled: false + Enabled: true # Checks for method calls with a space before the opening parenthesis. Lint/ParenthesesAsGroupedExpression: @@ -887,11 +886,11 @@ Lint/ParenthesesAsGroupedExpression: # Checks for `rand(1)` calls. Such calls always return `0` and most likely # a mistake. Lint/RandOne: - Enabled: false + Enabled: true # Use parentheses in the method call to avoid confusion about precedence. Lint/RequireParentheses: - Enabled: false + Enabled: true # Avoid rescuing the Exception class. Lint/RescueException: @@ -926,7 +925,7 @@ Lint/UnusedMethodArgument: # Unreachable code. Lint/UnreachableCode: - Enabled: false + Enabled: true # Checks for useless access modifiers. Lint/UselessAccessModifier: @@ -938,19 +937,19 @@ Lint/UselessAssignment: # Checks for comparison of something with itself. Lint/UselessComparison: - Enabled: false + Enabled: true # Checks for useless `else` in `begin..end` without `rescue`. Lint/UselessElseWithoutRescue: - Enabled: false + Enabled: true # Checks for useless setter call to a local variable. Lint/UselessSetterCall: - Enabled: false + Enabled: true # Possible use of operator/literal/variable in void context. Lint/Void: - Enabled: false + Enabled: true ##################### Performance ############################ @@ -959,11 +958,10 @@ Lint/Void: Performance/Casecmp: Enabled: true -# TODO: Enable DoubleStartEndWith Cop. # Use `str.{start,end}_with?(x, ..., y, ...)` instead of # `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`. Performance/DoubleStartEndWith: - Enabled: false + Enabled: true # TODO: Enable EndWith Cop. # Use `end_with?` instead of a regex match anchored to the end of a string. @@ -996,10 +994,9 @@ Performance/RedundantMerge: MaxKeyValuePairs: 2 Enabled: false -# TODO: Enable RedundantSortBy Cop. # Use `sort` instead of `sort_by { |x| x }`. Performance/RedundantSortBy: - Enabled: false + Enabled: true # Use `start_with?` instead of a regex match anchored to the beginning of a # string. @@ -1040,11 +1037,11 @@ Rails/Delegate: # Prefer `find_by` over `where.first`. Rails/FindBy: - Enabled: false + Enabled: true # Prefer `all.find_each` over `all.find`. Rails/FindEach: - Enabled: false + Enabled: true # Prefer has_many :through to has_and_belongs_to_many. Rails/HasAndBelongsToMany: @@ -1056,7 +1053,7 @@ Rails/Output: # Checks for incorrect grammar when using methods like `3.day.ago`. Rails/PluralizationGrammar: - Enabled: false + Enabled: true # Checks for `read_attribute(:attr)` and `write_attribute(:attr, val)`. Rails/ReadWriteAttribute: @@ -1064,7 +1061,7 @@ Rails/ReadWriteAttribute: # Checks the arguments of ActiveRecord scopes. Rails/ScopeArgs: - Enabled: false + Enabled: true # Checks the correct usage of time zone aware methods. # http://danilenko.org/2012/7/6/rails_timezones |