gitlab-dangerfiles 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30a4d627f19b9baece5e677425892f5ede2b883db11c57ae4178956975dcdb69
4
- data.tar.gz: dfb9f139593171a0ddf7b075993ebe9419c0b32a33a391c5b7dfa4814871f553
3
+ metadata.gz: 2f9d4db82aaf60ca573623de5e99c72f5518baef3181d8c854b52131ab4abf60
4
+ data.tar.gz: 06bb46e9c0c500cfa1d9e3aef672d529d99f70283ed66fd87291c66117205a96
5
5
  SHA512:
6
- metadata.gz: 504abc1a266560c6277dd9cb329b35894e2cdc958703403bdd88e3b2a7ad883860ed56be1bb14bf48529d0207b61f69a896260e4ab87cd0e251b373bcb902b18
7
- data.tar.gz: ba5ff6ef20d7571c70a6bc4b130b5b54a89881c3757bf2b4c6949be6e7c441ba9deca33b13753be8428f0877663d24410a05a9aa3e45bac8fc2f5ff9e5a6aeae
6
+ metadata.gz: 57da7c2b5d0bb5c47fff3b663d9fa9d3465b7eec5d343423148b11f78079224c5d8682692863ec9736fdccbd42cccf3e3127a7b85ce3f2973baa8108421e6ed0
7
+ data.tar.gz: be63b6430ab6bf1e4cfab3ee6849355331ccedb340a1fcdf1a4347c254a6c52c1feea88a3f9e67d2c2d3bd1aa734f22b59fca852558e788a5e4353b8f4456572
@@ -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
 
@@ -10,6 +10,7 @@ module Gitlab
10
10
  end
11
11
  LOCAL_RULES = %w[
12
12
  changes_size
13
+ commit_messages
13
14
  ].freeze
14
15
  CI_ONLY_RULES = %w[
15
16
  ].freeze
@@ -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?
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Dangerfiles
3
- VERSION = "2.1.0"
3
+ VERSION = "2.2.0"
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.0
4
+ version: 2.2.0
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-11 00:00:00.000000000 Z
11
+ date: 2021-07-06 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