diff options
Diffstat (limited to 'rubocop/cop/gitlab')
-rw-r--r-- | rubocop/cop/gitlab/deprecate_track_redis_hll_event.rb | 33 | ||||
-rw-r--r-- | rubocop/cop/gitlab/feature_available_usage.rb | 3 | ||||
-rw-r--r-- | rubocop/cop/gitlab/mark_used_feature_flags.rb | 2 |
3 files changed, 37 insertions, 1 deletions
diff --git a/rubocop/cop/gitlab/deprecate_track_redis_hll_event.rb b/rubocop/cop/gitlab/deprecate_track_redis_hll_event.rb new file mode 100644 index 00000000000..3e30f3aa4d0 --- /dev/null +++ b/rubocop/cop/gitlab/deprecate_track_redis_hll_event.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'rack/utils' + +module RuboCop + module Cop + module Gitlab + # This cop prevents from using deprecated `track_redis_hll_event` method. + # + # @example + # + # # bad + # track_redis_hll_event :show, name: 'p_analytics_valuestream' + # + # # good + # track_event :show, name: 'g_analytics_valuestream', destinations: [:redis_hll] + class DeprecateTrackRedisHLLEvent < RuboCop::Cop::Cop + MSG = '`track_redis_hll_event` is deprecated. Use `track_event` helper instead. ' \ + 'See https://docs.gitlab.com/ee/development/service_ping/implement.html#add-new-events' + + def_node_matcher :track_redis_hll_event_used?, <<~PATTERN + (send _ :track_redis_hll_event ...) + PATTERN + + def on_send(node) + return unless track_redis_hll_event_used?(node) + + add_offense(node, location: :selector) + end + end + end + end +end diff --git a/rubocop/cop/gitlab/feature_available_usage.rb b/rubocop/cop/gitlab/feature_available_usage.rb index b50bdd8ca43..f748b7d9111 100644 --- a/rubocop/cop/gitlab/feature_available_usage.rb +++ b/rubocop/cop/gitlab/feature_available_usage.rb @@ -23,6 +23,9 @@ module RuboCop operations security_and_compliance container_registry + environments + feature_flags + releases ].freeze EE_FEATURES = %i[requirements].freeze ALL_FEATURES = (FEATURES + EE_FEATURES).freeze diff --git a/rubocop/cop/gitlab/mark_used_feature_flags.rb b/rubocop/cop/gitlab/mark_used_feature_flags.rb index 0bebd7901f3..63bccec31c0 100644 --- a/rubocop/cop/gitlab/mark_used_feature_flags.rb +++ b/rubocop/cop/gitlab/mark_used_feature_flags.rb @@ -145,7 +145,7 @@ module RuboCop return unless node.children[opts_index] node.children[opts_index].each_pair.find do |pair| - pair.key.value == :feature_flag + pair.key.value == :_deprecated_feature_flag end&.value else arg_index = rugged_method?(node) ? 3 : 2 |