gitlab-dangerfiles 0.2.0 → 0.3.0

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: 679d12adff8fd532552d644bba3f1ae62395077310ffcc7aa62181b477f5453d
4
- data.tar.gz: f6460b3c349cf27d1a65246f41744cae15c95c0c949811aa1b972abe654b3e90
3
+ metadata.gz: 133950a9ab88093e18c6e394cadb8047a9975cd12b3f2cdec9167b07ca6677ff
4
+ data.tar.gz: fde2b4a7c3c0639fbc4682447b655bb9dfc16fd3a1e616fd54aad48c117856de
5
5
  SHA512:
6
- metadata.gz: 8ebcb0cd08d49021346a0b74adb50b5ff10a8fe64227e86f960a72e6cc88260f0249927088bae3e949ddbf9a295c65d2d4c005d8d4b0ee157a907f700b72ce46
7
- data.tar.gz: e747d6b68ca54ee597e008332a5bfc7d4fa01a437e44af42fc68d5ab28aaf674b2e76995ab792559016fa381c0cd1e08b58071bb5c3d4b66f37e8c7891bbaa77
6
+ metadata.gz: 55f2fb30261069530f151eef6396346abd7769fe0fdfde7b5e9f81a15aa70d81ba9ff63d3981b4aed62154563fefdfb0df9a12e39e2ed33a011c8315f372906f
7
+ data.tar.gz: b4abb0b2a90c088cd5a499b35ab2cc99dcbb579f61a0839056a8b8d910134e0cda0b5d1b5323a975fb48fa0afa5e8d86b4ea5cdc01317725e5e4893bd2658b83
@@ -9,6 +9,7 @@ module Danger
9
9
  # Common helper functions for our danger scripts.
10
10
  class Helper < Danger::Plugin
11
11
  RELEASE_TOOLS_BOT = "gitlab-release-tools-bot"
12
+ DRAFT_REGEX = /\A*#{Regexp.union(/(?i)(\[WIP\]\s*|WIP:\s*|WIP$)/, /(?i)(\[draft\]|\(draft\)|draft:|draft\s\-\s|draft$)/)}+\s*/i.freeze
12
13
  CATEGORY_LABELS = {
13
14
  docs: "~documentation", # Docs are reviewed along DevOps stages, so don't need roulette for now.
14
15
  none: "",
@@ -110,7 +111,9 @@ module Danger
110
111
  end
111
112
  end
112
113
 
113
- # Determines the categories a file is in, e.g., `[:frontend]`, `[:backend]`, or `%i[frontend engineering_productivity]`.
114
+ # Determines the categories a file is in, e.g., `[:frontend]`, `[:backend]`, or `%i[frontend engineering_productivity]`
115
+ # using filename regex and specific change regex if given.
116
+ #
114
117
  # @return Array<Symbol>
115
118
  def categories_for_file(file, categories)
116
119
  _, categories = categories.find do |key, _|
@@ -137,20 +140,16 @@ module Danger
137
140
  usernames.map { |u| Gitlab::Dangerfiles::Teammate.new("username" => u) }
138
141
  end
139
142
 
140
- def missing_database_labels(current_mr_labels)
141
- labels = if has_database_scoped_labels?(current_mr_labels)
142
- ["database"]
143
- else
144
- ["database", "database::review pending"]
145
- end
146
-
147
- labels - current_mr_labels
148
- end
149
-
150
143
  def sanitize_mr_title(title)
151
144
  title.gsub(/^WIP: */, "").gsub(/`/, '\\\`')
152
145
  end
153
146
 
147
+ def draft_mr?
148
+ return false unless gitlab_helper
149
+
150
+ DRAFT_REGEX.match?(gitlab_helper.mr_json["title"])
151
+ end
152
+
154
153
  def security_mr?
155
154
  return false unless gitlab_helper
156
155
 
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Dangerfiles
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-dangerfiles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rémy Coutable