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

merge_request_linter.rb « danger « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ed354bfc68db735e8dd4e193f8c37d2c452e8fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

base_linter_path = File.expand_path('base_linter', __dir__)

if defined?(Rails)
  require_dependency(base_linter_path)
else
  require_relative(base_linter_path)
end

module Gitlab
  module Danger
    class MergeRequestLinter < BaseLinter
      alias_method :lint, :lint_subject

      def self.subject_description
        'merge request title'
      end

      def self.mr_run_options_regex
        [
          'RUN AS-IF-FOSS',
          'UPDATE CACHE',
          'RUN ALL RSPEC',
          'SKIP RSPEC FAIL-FAST'
        ].join('|')
      end

      private

      def subject
        super.gsub(/\[?(#{self.class.mr_run_options_regex})\]?/, '').strip
      end
    end
  end
end