summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-19 15:07:52 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-19 15:12:15 +0200
commitd6f669774481b160c2d963b56309ab6262216c42 (patch)
tree0dd11b283a493370cebd07bf1e6f4bb316a10ad3
parentb6d3eadfe23997770ca260460c0e22fed6859d45 (diff)
downloadgitlab-ce-rubocop/enable-access-modifiers-cops.tar.gz
Enable Rubocop cops for invalid access modifiersrubocop/enable-access-modifiers-cops
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.
-rw-r--r--.rubocop.yml9
-rw-r--r--.rubocop_todo.yml8
-rw-r--r--app/models/concerns/token_authenticatable.rb2
-rw-r--r--lib/gitlab/ci/config/node/configurable.rb2
4 files changed, 11 insertions, 10 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index db0bcfadcf4..3f3a0561710 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -506,6 +506,15 @@ Metrics/PerceivedComplexity:
#################### 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
# without parentheses.
Lint/AmbiguousOperator:
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 9310e711889..05a5fae8543 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -19,10 +19,6 @@ Lint/AssignmentInCondition:
Lint/HandleExceptions:
Enabled: false
-# Offense count: 21
-Lint/IneffectiveAccessModifier:
- Enabled: false
-
# Offense count: 2
Lint/Loop:
Enabled: false
@@ -48,10 +44,6 @@ Lint/UnusedBlockArgument:
Lint/UnusedMethodArgument:
Enabled: false
-# Offense count: 11
-Lint/UselessAccessModifier:
- Enabled: false
-
# Offense count: 12
# Cop supports --auto-correct.
Performance/PushSplat:
diff --git a/app/models/concerns/token_authenticatable.rb b/app/models/concerns/token_authenticatable.rb
index 27a03b3bada..24c7b26d223 100644
--- a/app/models/concerns/token_authenticatable.rb
+++ b/app/models/concerns/token_authenticatable.rb
@@ -20,7 +20,7 @@ module TokenAuthenticatable
@token_fields || []
end
- private
+ private # rubocop:disable Lint/UselessAccessModifier
def add_authentication_token_field(token_field)
@token_fields = [] unless @token_fields
diff --git a/lib/gitlab/ci/config/node/configurable.rb b/lib/gitlab/ci/config/node/configurable.rb
index 37936fc8242..2592e1ec244 100644
--- a/lib/gitlab/ci/config/node/configurable.rb
+++ b/lib/gitlab/ci/config/node/configurable.rb
@@ -36,7 +36,7 @@ module Gitlab
Hash[(@nodes || {}).map { |key, factory| [key, factory.dup] }]
end
- private
+ private # rubocop:disable Lint/UselessAccessModifier
def node(symbol, entry_class, metadata)
factory = Node::Factory.new(entry_class)