gitlab-dangerfiles 2.1.1 → 2.2.1

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: 2e4bc738b166a81e3e3ebd009c67eb6205bd40155f624d62ee3b8b4e2a4c3203
4
- data.tar.gz: 7b0be83cf24f080a0d7d468db5656526de8a3937206624dcbba2cb59d44a5911
3
+ metadata.gz: 10b4151926ec3f1b573d1891138cca88e74e349484914f806307639e31aa8f5c
4
+ data.tar.gz: 3cfcb8533e082e7b157f6a99ea9e84aa3d357cd4035270bcfd717e2212182611
5
5
  SHA512:
6
- metadata.gz: bae09716c429d549b9624223997b20b3f0c75470aa72ccb6293f145b294bbbf97bd04c7e4ce0aeb791898b9eb3ba23f1b0d87b2e3b77d667d9c07de6f2d63749
7
- data.tar.gz: 2c2a4745c78288a38dec0e93f0193b5507b46680a7d029f34e1f8e90400e882ab17ef144d00f2085be06d91dbc4685df7d36af7af47bf029a94f38916f6c4586
6
+ metadata.gz: 50fe7e8cd2e7ca176639e416d6406f3ab327b95f61e7f07c1d329561cb172bbb73ca8cffb775d14dd4c4b3d375bdba5fd044ee9cc344298f8f27b3195d0765f1
7
+ data.tar.gz: debd9b7c5a598ee1bb2274900cd61a00b00a5ef96ad3af58b3445e30ba078ed49a5efa86976c11542e0b2652b4fb792604c16654c3f616315a37b63352c145cf
@@ -27,7 +27,8 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
- spec.add_dependency "danger-gitlab"
30
+ spec.add_dependency "danger-gitlab", ">= 8.0.0"
31
+ spec.add_dependency "danger", ">= 8.3.1"
31
32
 
32
33
  spec.add_development_dependency "rspec", "~> 3.0"
33
34
  spec.add_development_dependency "rspec-parameterized"
@@ -416,7 +416,7 @@ module Danger
416
416
  return nil unless ci?
417
417
  return nil if defined?(@force_changes_from_git)
418
418
 
419
- @changes_from_api ||= gitlab_helper.mr_changes.to_h["changes"]
419
+ @changes_from_api ||= gitlab_helper.mr_changes
420
420
  rescue
421
421
  # Fallback to the Git strategy in any case
422
422
  @force_changes_from_git = true
@@ -34,7 +34,7 @@ module Danger
34
34
  #
35
35
  # @return [Array<Spin>]
36
36
  def spin(project, categories = [nil], timezone_experiment: false)
37
- spins = categories.sort.map do |category|
37
+ spins = categories.sort_by(&:to_s).map do |category|
38
38
  including_timezone = INCLUDE_TIMEZONE_FOR_CATEGORY.fetch(category, timezone_experiment)
39
39
 
40
40
  spin_for_category(project, category, timezone_experiment: including_timezone)
@@ -6,6 +6,7 @@ require_relative "../../../gitlab/dangerfiles/merge_request_linter"
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
8
  THE_DANGER_JOB_TEXT = "the `%<job_name>` job"
9
+ MAX_COMMITS_COUNT = helper.config.max_commits_count
9
10
  MAX_COMMITS_COUNT_EXCEEDED_MESSAGE = <<~MSG
10
11
  This merge request includes more than %<max_commits_count>d commits. Each commit should meet the following criteria:
11
12
 
@@ -17,8 +18,6 @@ This merge request includes more than %<max_commits_count>d commits. Each commit
17
18
  If this merge request contains commits that do not meet this criteria and/or contains intermediate work, please rebase these commits into a smaller number of commits or split this merge request into multiple smaller merge requests.
18
19
  MSG
19
20
 
20
- max_commits_count = helper.config.max_commits_count
21
-
22
21
  def fail_commit(commit, message, more_info: true)
23
22
  self.fail(build_message(commit, message, more_info: more_info))
24
23
  end
@@ -104,8 +103,8 @@ def lint_commits(commits)
104
103
  end
105
104
  end
106
105
  else
107
- if count_non_fixup_commits(commit_linters) > max_commits_count
108
- self.warn(format(MAX_COMMITS_COUNT_EXCEEDED_MESSAGE, max_commits_count: max_commits_count))
106
+ if count_non_fixup_commits(commit_linters) > MAX_COMMITS_COUNT
107
+ self.warn(format(MAX_COMMITS_COUNT_EXCEEDED_MESSAGE, max_commits_count: MAX_COMMITS_COUNT))
109
108
  end
110
109
  end
111
110
 
@@ -12,6 +12,7 @@ module Gitlab
12
12
  SHORT_REFERENCE_REGEX = %r{([\w\-\/]+)?(?<!`)(#|!|&)\d+(?<!`)}.freeze
13
13
  # Milestone
14
14
  MS_SHORT_REFERENCE_REGEX = %r{([\w\-\/]+)?(?<!`)%"?\d{1,3}\.\d{1,3}"?(?<!`)}.freeze
15
+ SUGGESTIONS_APPLIED_COMMIT_REGEX = /Apply \d+ suggestion\(s\) to \d+ file\(s\)/.freeze
15
16
 
16
17
  def self.problems_mapping
17
18
  super.merge(
@@ -41,7 +42,7 @@ module Gitlab
41
42
  end
42
43
 
43
44
  def suggestion?
44
- commit.message.start_with?("Apply suggestion to")
45
+ SUGGESTIONS_APPLIED_COMMIT_REGEX.match?(commit.message)
45
46
  end
46
47
 
47
48
  def merge?
@@ -104,7 +104,7 @@ RSpec.shared_context "with dangerfile" do
104
104
  end
105
105
 
106
106
  let(:fake_git) { double("fake-git", added_files: added_files, modified_files: modified_files, deleted_files: deleted_files, renamed_files: renamed_files) }
107
- let(:fake_helper) { double("fake-helper", changes: changes, mr_iid: 1234, mr_title: mr_title, mr_labels: mr_labels) }
107
+ let(:fake_helper) { double("fake-helper", changes: changes, added_files: added_files, modified_files: modified_files, deleted_files: deleted_files, renamed_files: renamed_files, mr_iid: 1234, mr_title: mr_title, mr_labels: mr_labels) }
108
108
 
109
109
  before do
110
110
  allow(dangerfile).to receive(:git).and_return(fake_git)
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Dangerfiles
3
- VERSION = "2.1.1"
3
+ VERSION = "2.2.1"
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.1.1
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-15 00:00:00.000000000 Z
11
+ date: 2021-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-gitlab
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 8.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 8.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: danger
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 8.3.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 8.3.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rspec
29
43
  requirement: !ruby/object:Gem::Requirement