gitlab-dangerfiles 2.2.1 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10b4151926ec3f1b573d1891138cca88e74e349484914f806307639e31aa8f5c
4
- data.tar.gz: 3cfcb8533e082e7b157f6a99ea9e84aa3d357cd4035270bcfd717e2212182611
3
+ metadata.gz: b0c3470d9595a2aa541734ad57d7a47c189c89e6766f59b48baf8928bbd12a81
4
+ data.tar.gz: c97021338170135f2819563af31d9c8580e44e0b74c2a689c0f764d391ca8718
5
5
  SHA512:
6
- metadata.gz: 50fe7e8cd2e7ca176639e416d6406f3ab327b95f61e7f07c1d329561cb172bbb73ca8cffb775d14dd4c4b3d375bdba5fd044ee9cc344298f8f27b3195d0765f1
7
- data.tar.gz: debd9b7c5a598ee1bb2274900cd61a00b00a5ef96ad3af58b3445e30ba078ed49a5efa86976c11542e0b2652b4fb792604c16654c3f616315a37b63352c145cf
6
+ metadata.gz: f27ee9ec4cab2d09e2a4c796868f93c4b9e649fc9bcf16fdd3935c956cee3f4ab756e55a14f66ce82fa810354ac1dad087d09b7e6813fb4797a78372fd46e91f
7
+ data.tar.gz: e8b704505f0f93ab263207d15c8e0a5a7492f55bb18598c40f1fdec93dc6c79eb6ff1e7280642d71d950365b005d3082c43448c8fab702115e2acfc6d19b0a7b
data/README.md CHANGED
@@ -7,7 +7,7 @@ The goal of this gem is to centralize Danger plugins and rules that to be used b
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'gitlab-dangerfiles'
10
+ gem 'gitlab-dangerfiles', require: false
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -29,6 +29,8 @@ $ gem install gitlab-dangerfiles
29
29
  In your project's `Dangerfile`, add the following two line to import the plugins and rules from this gem:
30
30
 
31
31
  ```ruby
32
+ require 'gitlab-dangerfiles'
33
+
32
34
  # Get an instance of Gitlab::Dangerfiles
33
35
  gitlab_dangerfiles = Gitlab::Dangerfiles::Engine.new(self)
34
36
 
@@ -17,7 +17,9 @@ module Danger
17
17
  none: "",
18
18
  qa: "~QA",
19
19
  test: "~test ~Quality for `spec/features/*`",
20
+ # Deprecated as of 2.3.0 in favor of tooling
20
21
  engineering_productivity: '~"Engineering Productivity" for CI, Danger',
22
+ tooling: '~"type::tooling" for CI, Danger',
21
23
  ci_template: '~"ci::templates"',
22
24
  product_intelligence: '~"product intelligence"',
23
25
  }.freeze
@@ -211,7 +213,7 @@ module Danger
211
213
  # +filename_regex+ is the regex pattern to match file names. +changes_regex+ is the regex pattern to
212
214
  # match changed lines in files that match +filename_regex+
213
215
  #
214
- # @return [Array<Symbol>] the categories a file is in, e.g., +[:frontend]+, +[:backend]+, or +%i[frontend engineering_productivity]+
216
+ # @return [Array<Symbol>] the categories a file is in, e.g., +[:frontend]+, +[:backend]+, or +%i[frontend tooling]+
215
217
  # using filename regex (+filename_regex+) and specific change regex (+changes_regex+) from the given +categories+ hash.
216
218
  def categories_for_file(filename, categories)
217
219
  _, categories = categories.find do |key, _|
@@ -58,7 +58,7 @@ module Danger
58
58
  # Fetch an already picked backend reviewer, or pick one otherwise
59
59
  spin.reviewer = backend_spin&.reviewer || spin_for_category(project, :backend, timezone_experiment: including_timezone).reviewer
60
60
  end
61
- when :engineering_productivity
61
+ when :tooling, :engineering_productivity # Deprecated as of 2.3.0 in favor of tooling
62
62
  if spin.maintainer.nil?
63
63
  # Fetch an already picked backend maintainer, or pick one otherwise
64
64
  spin.maintainer = backend_spin&.maintainer || spin_for_category(project, :backend, timezone_experiment: including_timezone).maintainer
@@ -5,7 +5,7 @@ require_relative "../../../gitlab/dangerfiles/merge_request_linter"
5
5
 
6
6
  COMMIT_MESSAGE_GUIDELINES = "https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#commit-messages-guidelines"
7
7
  MORE_INFO = "For more information, take a look at our [Commit message guidelines](#{COMMIT_MESSAGE_GUIDELINES})."
8
- THE_DANGER_JOB_TEXT = "the `%<job_name>` job"
8
+ THE_DANGER_JOB_TEXT = "the `%<job_name>s` job"
9
9
  MAX_COMMITS_COUNT = helper.config.max_commits_count
10
10
  MAX_COMMITS_COUNT_EXCEEDED_MESSAGE = <<~MSG
11
11
  This merge request includes more than %<max_commits_count>d commits. Each commit should meet the following criteria:
@@ -28,6 +28,10 @@ module Gitlab
28
28
  @problems = {}
29
29
  end
30
30
 
31
+ def inspect
32
+ "#{self.class}:#{object_id} @commit=#{@commit} @problems=#{@problems}"
33
+ end
34
+
31
35
  def failed?
32
36
  problems.any?
33
37
  end
@@ -9,9 +9,9 @@ module Gitlab
9
9
  MAX_CHANGED_FILES_IN_COMMIT = 3
10
10
  MAX_CHANGED_LINES_IN_COMMIT = 30
11
11
  # Issue, MR, Epic
12
- SHORT_REFERENCE_REGEX = %r{([\w\-\/]+)?(?<!`)(#|!|&)\d+(?<!`)}.freeze
12
+ SHORT_REFERENCE_REGEX = %r{(\S*([\w\-\/]+)?(?<!`)(#|!|&)\d+(?<!`))}.freeze
13
13
  # Milestone
14
- MS_SHORT_REFERENCE_REGEX = %r{([\w\-\/]+)?(?<!`)%"?\d{1,3}\.\d{1,3}"?(?<!`)}.freeze
14
+ MS_SHORT_REFERENCE_REGEX = %r{(\S*([\w\-\/]+)?(?<!`)%"?\d{1,3}\.\d{1,3}"?(?<!`))}.freeze
15
15
  SUGGESTIONS_APPLIED_COMMIT_REGEX = /Apply \d+ suggestion\(s\) to \d+ file\(s\)/.freeze
16
16
 
17
17
  def self.problems_mapping
@@ -143,8 +143,13 @@ module Gitlab
143
143
  end
144
144
 
145
145
  def message_contains_short_reference?
146
- commit.message.match?(SHORT_REFERENCE_REGEX) ||
147
- commit.message.match?(MS_SHORT_REFERENCE_REGEX)
146
+ match_data = commit.message.match(SHORT_REFERENCE_REGEX) ||
147
+ commit.message.match(MS_SHORT_REFERENCE_REGEX)
148
+
149
+ return false unless match_data
150
+
151
+ # Any URL would include "//". This works for http/https/ftp etc.
152
+ !match_data[1].include?("//")
148
153
  end
149
154
 
150
155
  def emoji_checker
@@ -95,7 +95,7 @@ module Gitlab
95
95
  area = role[/Software Engineer in Test(?:.*?, (\w+))/, 1]
96
96
 
97
97
  area && labels.any?("devops::#{area.downcase}") if kind == :reviewer
98
- when :engineering_productivity
98
+ when :tooling, :engineering_productivity # Deprecated as of 2.3.0 in favor of tooling
99
99
  return false unless role[/Engineering Productivity/]
100
100
  return true if kind == :reviewer
101
101
  return true if capabilities(project).include?("#{kind} engineering_productivity")
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Dangerfiles
3
- VERSION = "2.2.1"
3
+ VERSION = "2.3.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-dangerfiles
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-07 00:00:00.000000000 Z
11
+ date: 2021-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-gitlab