dependabot-common 0.216.0 → 0.216.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: 645d08a2a5cfd122e1ec0bb4302d7c4e80bd0348e0c0e52d28dc210d196b963b
4
- data.tar.gz: 25d81216a7b48d60b332d241e06f3a7dcc384b06ea3f5fac1dcc02949da226dc
3
+ metadata.gz: cc44d20c1eea5ffcfebda79597511add6d56ecad33107329dd60223d39f14185
4
+ data.tar.gz: 1f483e056ca6d4e065a6b81d8d2491afda80f2c7820b1dee3ece09efc3ce0fa5
5
5
  SHA512:
6
- metadata.gz: 8ef726592da7c2ff04784322801d12902ab42613e53b084687acdbfb479982e60a5303cb6e7f249e5525547a7b7681af48c3afe9df16cfda435b771e5e3f84ad
7
- data.tar.gz: ef3a1010b2dd5736c9595754b1eb1cf1cca4cd7eecdfae551b97a2d84c71952ccad43bedafab0f9b6cea07892afbff41b766d9d8941ae10bcd7eedb434970aa3
6
+ metadata.gz: de74b6faf4093eb8ccc59c99e85f561f0967d8f453cd20fd52f973a1def74c0fc588f88e8251adae1bb0a62a17efb4c81c80b7dedcc9098d79c290e36f43b3f8
7
+ data.tar.gz: cfc902894c13a7c0631def4ef00439e0eb0b8bb668224954113cdf48d5a4010d083efe5d650996a90c4bda4a5e2410d6d0a002d3cfb18837b9f46a93852a43e5
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dependabot
4
+ class DependencyGroup
5
+ attr_reader :name, :rules
6
+
7
+ def initialize(name:, rules:)
8
+ @name = name
9
+ @rules = rules
10
+ end
11
+ end
12
+ end
@@ -80,7 +80,7 @@ module Dependabot
80
80
 
81
81
  def initialize(file_path, msg = nil)
82
82
  @file_path = file_path
83
- super("#{file_path} not found" || msg)
83
+ super(msg || "#{file_path} not found")
84
84
  end
85
85
 
86
86
  def file_name
@@ -98,7 +98,7 @@ module Dependabot
98
98
 
99
99
  def initialize(file_path, msg = nil)
100
100
  @file_path = file_path
101
- super(msg)
101
+ super(msg || "#{file_path} not parseable")
102
102
  end
103
103
 
104
104
  def file_name
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dependabot
4
+ class PullRequestCreator
5
+ class BranchNamer
6
+ class DependencyGroupStrategy
7
+ def initialize(dependencies:, files:, target_branch:, dependency_group:,
8
+ separator: "/", prefix: "dependabot", max_length: nil)
9
+ @dependencies = dependencies
10
+ @files = files
11
+ @target_branch = target_branch
12
+ @dependency_group = dependency_group
13
+ @separator = separator
14
+ @prefix = prefix
15
+ @max_length = max_length
16
+ end
17
+
18
+ # FIXME: Incorporate max_length truncation once we allow user config
19
+ #
20
+ # For now, we are using a placeholder DependencyGroup with a
21
+ # fixed-length name, so we can punt on handling truncation until
22
+ # we determine the strict validation rules for names
23
+ def new_branch_name
24
+ File.join(prefixes, dependency_group.name, prototype_suffix).gsub("/", separator)
25
+ end
26
+
27
+ private
28
+
29
+ attr_reader :dependencies, :dependency_group, :files, :target_branch, :separator, :prefix, :max_length
30
+
31
+ def prefixes
32
+ [
33
+ prefix,
34
+ package_manager,
35
+ directory,
36
+ target_branch
37
+ ].compact
38
+ end
39
+
40
+ # FIXME: Remove once grouped PRs can supersede each other
41
+ def prototype_suffix
42
+ "prototype-#{Time.now.utc.to_i}"
43
+ end
44
+
45
+ def package_manager
46
+ dependencies.first.package_manager
47
+ end
48
+
49
+ def directory
50
+ files.first.directory.tr(" ", "-")
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -5,18 +5,19 @@ require "digest"
5
5
  require "dependabot/metadata_finders"
6
6
  require "dependabot/pull_request_creator"
7
7
  require "dependabot/pull_request_creator/branch_namer/solo_strategy"
8
+ require "dependabot/pull_request_creator/branch_namer/dependency_group_strategy"
8
9
 
9
10
  module Dependabot
10
11
  class PullRequestCreator
11
12
  class BranchNamer
12
- attr_reader :dependencies, :files, :target_branch, :separator, :prefix, :max_length, :group_rule
13
+ attr_reader :dependencies, :files, :target_branch, :separator, :prefix, :max_length, :dependency_group
13
14
 
14
- def initialize(dependencies:, files:, target_branch:, group_rule: nil,
15
+ def initialize(dependencies:, files:, target_branch:, dependency_group: nil,
15
16
  separator: "/", prefix: "dependabot", max_length: nil)
16
17
  @dependencies = dependencies
17
18
  @files = files
18
19
  @target_branch = target_branch
19
- @group_rule = group_rule
20
+ @dependency_group = dependency_group
20
21
  @separator = separator
21
22
  @prefix = prefix
22
23
  @max_length = max_length
@@ -30,7 +31,7 @@ module Dependabot
30
31
 
31
32
  def strategy
32
33
  @strategy ||=
33
- if group_rule.nil?
34
+ if dependency_group.nil?
34
35
  SoloStrategy.new(
35
36
  dependencies: dependencies,
36
37
  files: files,
@@ -40,11 +41,11 @@ module Dependabot
40
41
  max_length: max_length
41
42
  )
42
43
  else
43
- GroupRuleStrategy.new(
44
+ DependencyGroupStrategy.new(
44
45
  dependencies: dependencies,
45
46
  files: files,
46
47
  target_branch: target_branch,
47
- group_rule: group_rule,
48
+ dependency_group: dependency_group,
48
49
  separator: separator,
49
50
  prefix: prefix,
50
51
  max_length: max_length
@@ -52,7 +52,7 @@ module Dependabot
52
52
  end
53
53
 
54
54
  def pr_message
55
- suffixed_pr_message_header + commit_message_intro + \
55
+ suffixed_pr_message_header + commit_message_intro +
56
56
  metadata_cascades + prefixed_pr_message_footer
57
57
  rescue StandardError => e
58
58
  Dependabot.logger.error("Error while generating PR message: #{e.message}")
@@ -49,7 +49,7 @@ module Dependabot
49
49
  :commit_message_options, :vulnerabilities_fixed,
50
50
  :reviewers, :assignees, :milestone, :branch_name_separator,
51
51
  :branch_name_prefix, :branch_name_max_length, :github_redirection_service,
52
- :custom_headers, :provider_metadata
52
+ :custom_headers, :provider_metadata, :dependency_group
53
53
 
54
54
  def initialize(source:, base_commit:, dependencies:, files:, credentials:,
55
55
  pr_message_header: nil, pr_message_footer: nil,
@@ -61,7 +61,7 @@ module Dependabot
61
61
  automerge_candidate: false,
62
62
  github_redirection_service: DEFAULT_GITHUB_REDIRECTION_SERVICE,
63
63
  custom_headers: nil, require_up_to_date_base: false,
64
- provider_metadata: {}, message: nil)
64
+ provider_metadata: {}, message: nil, dependency_group: nil)
65
65
  @dependencies = dependencies
66
66
  @source = source
67
67
  @base_commit = base_commit
@@ -87,6 +87,7 @@ module Dependabot
87
87
  @require_up_to_date_base = require_up_to_date_base
88
88
  @provider_metadata = provider_metadata
89
89
  @message = message
90
+ @dependency_group = dependency_group
90
91
 
91
92
  check_dependencies_have_previous_version
92
93
  end
@@ -235,7 +236,7 @@ module Dependabot
235
236
  dependencies: dependencies,
236
237
  files: files,
237
238
  target_branch: source.branch,
238
- group_rule: nil,
239
+ dependency_group: dependency_group,
239
240
  separator: branch_name_separator,
240
241
  prefix: branch_name_prefix,
241
242
  max_length: branch_name_max_length
data/lib/dependabot.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.216.0"
4
+ VERSION = "0.216.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.216.0
4
+ version: 0.216.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-12 00:00:00.000000000 Z
11
+ date: 2023-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-codecommit
@@ -318,14 +318,14 @@ dependencies:
318
318
  requirements:
319
319
  - - "~>"
320
320
  - !ruby/object:Gem::Version
321
- version: 1.48.0
321
+ version: 1.50.0
322
322
  type: :development
323
323
  prerelease: false
324
324
  version_requirements: !ruby/object:Gem::Requirement
325
325
  requirements:
326
326
  - - "~>"
327
327
  - !ruby/object:Gem::Version
328
- version: 1.48.0
328
+ version: 1.50.0
329
329
  - !ruby/object:Gem::Dependency
330
330
  name: rubocop-performance
331
331
  requirement: !ruby/object:Gem::Requirement
@@ -432,6 +432,7 @@ files:
432
432
  - lib/dependabot/config/update_config.rb
433
433
  - lib/dependabot/dependency.rb
434
434
  - lib/dependabot/dependency_file.rb
435
+ - lib/dependabot/dependency_group.rb
435
436
  - lib/dependabot/errors.rb
436
437
  - lib/dependabot/experiments.rb
437
438
  - lib/dependabot/file_fetchers.rb
@@ -447,7 +448,6 @@ files:
447
448
  - lib/dependabot/file_updaters/vendor_updater.rb
448
449
  - lib/dependabot/git_commit_checker.rb
449
450
  - lib/dependabot/git_metadata_fetcher.rb
450
- - lib/dependabot/group_rule.rb
451
451
  - lib/dependabot/logger.rb
452
452
  - lib/dependabot/metadata_finders.rb
453
453
  - lib/dependabot/metadata_finders/README.md
@@ -460,7 +460,7 @@ files:
460
460
  - lib/dependabot/pull_request_creator/azure.rb
461
461
  - lib/dependabot/pull_request_creator/bitbucket.rb
462
462
  - lib/dependabot/pull_request_creator/branch_namer.rb
463
- - lib/dependabot/pull_request_creator/branch_namer/group_rule_strategy.rb
463
+ - lib/dependabot/pull_request_creator/branch_namer/dependency_group_strategy.rb
464
464
  - lib/dependabot/pull_request_creator/branch_namer/solo_strategy.rb
465
465
  - lib/dependabot/pull_request_creator/codecommit.rb
466
466
  - lib/dependabot/pull_request_creator/commit_signer.rb
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Dependabot
4
- class GroupRule
5
- attr_reader :name
6
-
7
- def initialize(name)
8
- @name = name
9
- end
10
- end
11
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Dependabot
4
- class PullRequestCreator
5
- class BranchNamer
6
- class GroupRuleStrategy
7
- def initialize(dependencies:, files:, target_branch:, group_rule:,
8
- separator: "/", prefix: "dependabot", max_length: nil)
9
- @dependencies = dependencies
10
- @files = files
11
- @target_branch = target_branch
12
- @group_rule = group_rule
13
- @separator = separator
14
- @prefix = prefix
15
- @max_length = max_length
16
- end
17
-
18
- def new_branch_name
19
- group_rule.name
20
- end
21
-
22
- private
23
-
24
- attr_reader :group_rule
25
- end
26
- end
27
- end
28
- end