提交 d6f66977 编写于 作者: G Grzegorz Bizon

Enable Rubocop cops for invalid access modifiers

This enables following cops:

Check for useless access modifiers

  Lint/UselessAccessModifier

Checks for attempts to use `private` or `protected` to set the
visibility of a class method, which does not work.

  Lint/IneffectiveAccessModifier

This also disables two false possitives in concerns.
上级 b6d3eadf
...@@ -506,6 +506,15 @@ Metrics/PerceivedComplexity: ...@@ -506,6 +506,15 @@ Metrics/PerceivedComplexity:
#################### Lint ################################ #################### Lint ################################
# Checks for useless access modifiers.
Lint/UselessAccessModifier:
Enabled: true
# Checks for attempts to use `private` or `protected` to set the visibility
# of a class method, which does not work.
Lint/IneffectiveAccessModifier:
Enabled: false
# Checks for ambiguous operators in the first argument of a method invocation # Checks for ambiguous operators in the first argument of a method invocation
# without parentheses. # without parentheses.
Lint/AmbiguousOperator: Lint/AmbiguousOperator:
......
...@@ -19,10 +19,6 @@ Lint/AssignmentInCondition: ...@@ -19,10 +19,6 @@ Lint/AssignmentInCondition:
Lint/HandleExceptions: Lint/HandleExceptions:
Enabled: false Enabled: false
# Offense count: 21
Lint/IneffectiveAccessModifier:
Enabled: false
# Offense count: 2 # Offense count: 2
Lint/Loop: Lint/Loop:
Enabled: false Enabled: false
...@@ -48,10 +44,6 @@ Lint/UnusedBlockArgument: ...@@ -48,10 +44,6 @@ Lint/UnusedBlockArgument:
Lint/UnusedMethodArgument: Lint/UnusedMethodArgument:
Enabled: false Enabled: false
# Offense count: 11
Lint/UselessAccessModifier:
Enabled: false
# Offense count: 12 # Offense count: 12
# Cop supports --auto-correct. # Cop supports --auto-correct.
Performance/PushSplat: Performance/PushSplat:
......
...@@ -20,7 +20,7 @@ module TokenAuthenticatable ...@@ -20,7 +20,7 @@ module TokenAuthenticatable
@token_fields || [] @token_fields || []
end end
private private # rubocop:disable Lint/UselessAccessModifier
def add_authentication_token_field(token_field) def add_authentication_token_field(token_field)
@token_fields = [] unless @token_fields @token_fields = [] unless @token_fields
......
...@@ -36,7 +36,7 @@ module Gitlab ...@@ -36,7 +36,7 @@ module Gitlab
Hash[(@nodes || {}).map { |key, factory| [key, factory.dup] }] Hash[(@nodes || {}).map { |key, factory| [key, factory.dup] }]
end end
private private # rubocop:disable Lint/UselessAccessModifier
def node(symbol, entry_class, metadata) def node(symbol, entry_class, metadata)
factory = Node::Factory.new(entry_class) factory = Node::Factory.new(entry_class)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册