diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-01 06:06:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-01 06:06:11 +0000 |
commit | 864475536355651a9f7caa5b1606aa5640424ec3 (patch) | |
tree | 1dc80c96ddf3f9049c4a163b4c49f052a9b1a4ad /rubocop | |
parent | 7ddd5846999029916b2b6d8560b5b0f02ec0f6ea (diff) | |
download | gitlab-ce-864475536355651a9f7caa5b1606aa5640424ec3.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/cop/ignored_columns.rb | 20 | ||||
-rw-r--r-- | rubocop/rubocop.rb | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/rubocop/cop/ignored_columns.rb b/rubocop/cop/ignored_columns.rb new file mode 100644 index 00000000000..14bcfa04ae1 --- /dev/null +++ b/rubocop/cop/ignored_columns.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + # Cop that blacklists the usage of Group.public_or_visible_to_user + class IgnoredColumns < RuboCop::Cop::Cop + MSG = 'Use `IgnoredColumns` concern instead of adding to `self.ignored_columns`.' + + def_node_matcher :ignored_columns?, <<~PATTERN + (send (self) :ignored_columns) + PATTERN + + def on_send(node) + return unless ignored_columns?(node) + + add_offense(node, location: :expression) + end + end + end +end diff --git a/rubocop/rubocop.rb b/rubocop/rubocop.rb index 49d582bf034..9c9948e2a61 100644 --- a/rubocop/rubocop.rb +++ b/rubocop/rubocop.rb @@ -54,3 +54,4 @@ require_relative 'cop/group_public_or_visible_to_user' require_relative 'cop/inject_enterprise_edition_module' require_relative 'cop/graphql/authorize_types' require_relative 'cop/graphql/descriptions' +require_relative 'cop/ignored_columns' |