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

usage_data_helpers.rb « rubocop - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a625259477845b25d548518de4fa92c35edd52ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

module RuboCop
  module UsageDataHelpers
    def in_usage_data_file?(node)
      filepath(node).end_with?('gitlab/usage_data.rb')
    end

    def in_instrumentation_file?(node)
      filepath(node).start_with?('lib/gitlab/usage/metrics/instrumentations') && File.extname(filepath(node)) == '.rb'
    end

    private

    def filepath(node)
      node.location.expression.source_buffer.name
    end
  end
end