Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-11-14 21:09:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-14 21:09:21 +0300
commitc3ccd2fdf136f7b3962ef5243ed6ce01de47d8ef (patch)
tree4d8b1df9d6b4bc09edcf8ae610e014b36a2d4269 /rubocop
parent15c1cc886c5785d49f2a6dae064a1e8290f59f46 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r--rubocop/cop/gitlab/avoid_gitlab_instance_checks.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/rubocop/cop/gitlab/avoid_gitlab_instance_checks.rb b/rubocop/cop/gitlab/avoid_gitlab_instance_checks.rb
index 6aac3649b04..7cae7ab8549 100644
--- a/rubocop/cop/gitlab/avoid_gitlab_instance_checks.rb
+++ b/rubocop/cop/gitlab/avoid_gitlab_instance_checks.rb
@@ -27,7 +27,7 @@ module RuboCop
MSG = 'Avoid the use of `%{name}`. Use Gitlab::Saas.feature_available?. ' \
'See https://docs.gitlab.com/ee/development/ee_features.html#saas-only-feature'
RESTRICT_ON_SEND = %i[
- com? com_except_jh? com_and_canary? com_but_not_canary? org_or_com? should_check_namespace_plan?
+ com? com_except_jh? com_and_canary? com_but_not_canary? org_or_com? should_check_namespace_plan? enabled?
].freeze
# @!method gitlab?(node)
@@ -43,8 +43,16 @@ module RuboCop
{nil? (cbase)} :Gitlab) :CurrentSettings) :should_check_namespace_plan?)
PATTERN
+ # @!method saas_enabled?(node)
+ def_node_matcher :saas_enabled?, <<~PATTERN
+ (send
+ (const
+ (const
+ {nil? (cbase)} :Gitlab) :Saas) :enabled?)
+ PATTERN
+
def on_send(node)
- return unless gitlab?(node) || should_check_namespace_plan?(node)
+ return unless gitlab?(node) || should_check_namespace_plan?(node) || saas_enabled?(node)
add_offense(node, message: format(MSG, name: node.method_name))
end