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>2022-08-31 00:09:41 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-31 00:09:41 +0300
commit6377fb774cd6bf76ea235c9e07d88cdb014ee1ad (patch)
tree83c89564ed1a9c24c258f9bcc8b136fa6d57dfcb /rubocop
parent6619ed911ffab93b90756bf392d2925fdc0c1ee2 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r--rubocop/cop/gitlab/mark_used_feature_flags.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/rubocop/cop/gitlab/mark_used_feature_flags.rb b/rubocop/cop/gitlab/mark_used_feature_flags.rb
index 9f637c88b01..df524c8b0d2 100644
--- a/rubocop/cop/gitlab/mark_used_feature_flags.rb
+++ b/rubocop/cop/gitlab/mark_used_feature_flags.rb
@@ -83,12 +83,12 @@ module RuboCop
# Additionally, mark experiment-related feature flag as used as well
matching_feature_flags = defined_feature_flags.select { |flag| flag == "#{flag_value}_experiment_percentage" }
matching_feature_flags.each do |matching_feature_flag|
- puts_if_ci(node, "The '#{matching_feature_flag}' feature flag tracks the #{flag_value} experiment, which is still in use, so we'll mark it as used.")
+ puts_if_debug(node, "The '#{matching_feature_flag}' feature flag tracks the #{flag_value} experiment, which is still in use, so we'll mark it as used.")
save_used_feature_flag(matching_feature_flag)
end
end
elsif flag_arg_is_send_type?(flag_arg)
- puts_if_ci(node, "Feature flag is dynamic: '#{flag_value}.")
+ puts_if_debug(node, "Feature flag is dynamic: '#{flag_value}.")
elsif flag_arg_is_dstr_or_dsym?(flag_arg)
str_prefix = flag_arg.children[0]
rest_children = flag_arg.children[1..]
@@ -96,21 +96,23 @@ module RuboCop
if rest_children.none? { |child| child.str_type? }
matching_feature_flags = defined_feature_flags.select { |flag| flag.start_with?(str_prefix.value) }
matching_feature_flags.each do |matching_feature_flag|
- puts_if_ci(node, "The '#{matching_feature_flag}' feature flag starts with '#{str_prefix.value}', so we'll optimistically mark it as used.")
+ puts_if_debug(node, "The '#{matching_feature_flag}' feature flag starts with '#{str_prefix.value}', so we'll optimistically mark it as used.")
save_used_feature_flag(matching_feature_flag)
end
else
- puts_if_ci(node, "Interpolated feature flag name has multiple static string parts, we won't track it.")
+ puts_if_debug(node, "Interpolated feature flag name has multiple static string parts, we won't track it.")
end
else
- puts_if_ci(node, "Feature flag has an unknown type: #{flag_arg.type}.")
+ puts_if_debug(node, "Feature flag has an unknown type: #{flag_arg.type}.")
end
end
private
- def puts_if_ci(node, text)
- puts "#{text} (call: `#{node.source}`, source: #{node.location.expression.source_buffer.name})" if ENV['CI']
+ def puts_if_debug(node, text)
+ return unless RuboCop::ConfigLoader.debug
+
+ warn "#{text} (call: `#{node.source}`, source: #{node.location.expression.source_buffer.name})"
end
def save_used_feature_flag(feature_flag_name)