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.
This commit is contained in:
Grzegorz Bizon 2016-07-19 15:07:52 +02:00
parent b6d3eadfe2
commit d6f6697744
4 changed files with 11 additions and 10 deletions

View File

@ -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:

View File

@ -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:
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:

View File

@ -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

View File

@ -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)