dependabot-common 0.217.0 → 0.219.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: 0d5abb76fb8627e0143acff75fd3b34d60e7ff6acb73d27bf78fffd4964f73ba
4
- data.tar.gz: f2c88e753d1e7b7c7b3dea7e4f5b1b8ab9e432767789ec33a80616c125dbd2d2
3
+ metadata.gz: 9de5ea53359451b6552e39b450ef6c53c46d0d99becf02b15949e3af086f7ed8
4
+ data.tar.gz: aca210e308541379b560262139f618c9721ae905835607fe46425d1b4e702a5d
5
5
  SHA512:
6
- metadata.gz: a787ec426a2d6c6c5728420e5af6d5284ee16f385977360a25b0b81a7afad39fb2a351b3f5b801e475a2ada914fc1e856e0c4de4579f8b4d4aece4f73a5f77d7
7
- data.tar.gz: 39d1cfbc804401a119627f00f4ba56d188195cf9833c96104efcd3fdc041984145783934a52c44e0cce43d6475362c49ce1e8516815724af06675c6f91b1f85f
6
+ metadata.gz: a9c643d8050004fe119010919e4b6a08842ef454055332e4ca14c23f6398c05955d990d17e4d8e60f626a181eae4cb3dc8eab911c06752064de08ebcc88ff3e0
7
+ data.tar.gz: c7bfe1aad5c0231e4a02cb0003a83f133ad82e59cedc035aee9dc3f7ce4d1abbc5d133cd97be54a90c30171b34fc8ca51189fbc92a9d37f1f5ac37896c2c9b56
@@ -199,6 +199,10 @@ module Dependabot
199
199
  self == other
200
200
  end
201
201
 
202
+ def specific_requirements
203
+ requirements.select { |r| requirement_class.new(r[:requirement]).specific? }
204
+ end
205
+
202
206
  def requirement_class
203
207
  Utils.requirement_class_for_package_manager(package_manager)
204
208
  end
@@ -16,5 +16,9 @@ module Dependabot
16
16
  @dependencies.include?(dependency) if @dependencies.any?
17
17
  rules.any? { |rule| WildcardMatcher.match?(rule, dependency.name) }
18
18
  end
19
+
20
+ def to_h
21
+ { "name" => name }
22
+ end
19
23
  end
20
24
  end
@@ -162,6 +162,24 @@ module Dependabot
162
162
  false
163
163
  end
164
164
 
165
+ def dependency_source_details
166
+ sources =
167
+ dependency.requirements.
168
+ map { |requirement| requirement.fetch(:source) }.uniq.compact.
169
+ select { |source| source[:type] == "git" }
170
+
171
+ return sources.first if sources.count <= 1
172
+
173
+ # If there are multiple source URLs, then it's unclear how we should
174
+ # proceed
175
+ raise "Multiple sources! #{sources.join(', ')}" if sources.map { |s| s[:url] }.uniq.count > 1
176
+
177
+ # Otherwise it's reasonable to take the first source and use that. This
178
+ # will happen if we have multiple git sources with difference references
179
+ # specified. In that case it's fine to update them all.
180
+ sources.first
181
+ end
182
+
165
183
  private
166
184
 
167
185
  attr_reader :dependency, :credentials, :ignored_versions
@@ -322,26 +340,6 @@ module Dependabot
322
340
  end
323
341
  end
324
342
 
325
- def dependency_source_details
326
- sources =
327
- dependency.requirements.
328
- map { |requirement| requirement.fetch(:source) }.uniq.compact.
329
- select { |source| source[:type] == "git" }
330
-
331
- return sources.first if sources.count <= 1
332
-
333
- # If there are multiple source types, or multiple source URLs, then it's
334
- # unclear how we should proceed
335
- if sources.map { |s| [s.fetch(:type), s.fetch(:url, nil)] }.uniq.count > 1
336
- raise "Multiple sources! #{sources.join(', ')}"
337
- end
338
-
339
- # Otherwise it's reasonable to take the first source and use that. This
340
- # will happen if we have multiple git sources with difference references
341
- # specified. In that case it's fine to update them all.
342
- sources.first
343
- end
344
-
345
343
  def ref_or_branch
346
344
  dependency_source_details.fetch(:ref) ||
347
345
  dependency_source_details.fetch(:branch)
@@ -108,7 +108,7 @@ module Dependabot
108
108
  service_pack_uri = uri
109
109
  service_pack_uri += ".git" unless service_pack_uri.end_with?(".git") || skip_git_suffix(uri)
110
110
 
111
- env = { "PATH" => ENV.fetch("PATH", nil) }
111
+ env = { "PATH" => ENV.fetch("PATH", nil), "GIT_TERMINAL_PROMPT" => "0" }
112
112
  command = "git ls-remote #{service_pack_uri}"
113
113
  command = SharedHelpers.escape_command(command)
114
114
 
@@ -20,9 +20,16 @@ module Dependabot
20
20
  def releases_url
21
21
  return unless source
22
22
 
23
+ # Azure does not provide tags via API, so we can't check whether
24
+ # there are any releases. So, optimistically return the tags location
25
+ return "#{source.url}/tags" if source.provider == "azure"
26
+
27
+ # If there are no releases, we won't be linking to the releases page
28
+ return unless all_releases.any?
29
+
23
30
  case source.provider
24
31
  when "github" then "#{source.url}/releases"
25
- when "gitlab", "azure" then "#{source.url}/tags"
32
+ when "gitlab" then "#{source.url}/tags"
26
33
  when "bitbucket", "codecommit" then nil
27
34
  else raise "Unexpected repo provider '#{source.provider}'"
28
35
  end
@@ -21,7 +21,7 @@ module Dependabot
21
21
  # fixed-length name, so we can punt on handling truncation until
22
22
  # we determine the strict validation rules for names
23
23
  def new_branch_name
24
- File.join(prefixes, dependency_group.name, prototype_suffix).gsub("/", separator)
24
+ File.join(prefixes, timestamped_group_name).gsub("/", separator)
25
25
  end
26
26
 
27
27
  private
@@ -37,9 +37,11 @@ module Dependabot
37
37
  ].compact
38
38
  end
39
39
 
40
- # FIXME: Remove once grouped PRs can supersede each other
41
- def prototype_suffix
42
- "prototype-#{Time.now.utc.to_i}"
40
+ # When superseding a grouped update pull request, we will have a period
41
+ # of time when there are two branches for the group so we use a timestamp
42
+ # to avoid collisions.
43
+ def timestamped_group_name
44
+ "#{dependency_group.name}-#{Time.now.utc.to_i}"
43
45
  end
44
46
 
45
47
  def package_manager
@@ -222,9 +222,12 @@ module Dependabot
222
222
  msg + "to permit the latest version."
223
223
  end
224
224
 
225
+ # rubocop:disable Metrics/CyclomaticComplexity
225
226
  # rubocop:disable Metrics/PerceivedComplexity
226
227
  # rubocop:disable Metrics/AbcSize
227
228
  def version_commit_message_intro
229
+ return group_intro if dependency_group
230
+
228
231
  return multidependency_property_intro if dependencies.count > 1 && updating_a_property?
229
232
 
230
233
  return dependency_set_intro if dependencies.count > 1 && updating_a_dependency_set?
@@ -251,7 +254,7 @@ module Dependabot
251
254
 
252
255
  msg
253
256
  end
254
-
257
+ # rubocop:enable Metrics/CyclomaticComplexity
255
258
  # rubocop:enable Metrics/PerceivedComplexity
256
259
  # rubocop:enable Metrics/AbcSize
257
260
 
@@ -309,6 +312,19 @@ module Dependabot
309
312
  msg
310
313
  end
311
314
 
315
+ def group_intro
316
+ update_count = dependencies.map(&:name).uniq.count
317
+
318
+ msg = "Bumps the #{dependency_group.name} group#{pr_name_directory} with #{update_count} update"
319
+ msg += if update_count > 1
320
+ "s: #{dependency_links[0..-2].join(', ')} and #{dependency_links[-1]}."
321
+ else
322
+ ": #{dependency_links.first}."
323
+ end
324
+
325
+ msg
326
+ end
327
+
312
328
  def from_version_msg(previous_version)
313
329
  return "" unless previous_version
314
330
 
@@ -357,14 +373,19 @@ module Dependabot
357
373
  end
358
374
 
359
375
  def dependency_links
360
- dependencies.map do |dependency|
361
- if source_url(dependency)
362
- "[#{dependency.display_name}](#{source_url(dependency)})"
363
- elsif homepage_url(dependency)
364
- "[#{dependency.display_name}](#{homepage_url(dependency)})"
365
- else
366
- dependency.display_name
367
- end
376
+ return @dependency_links if defined?(@dependency_links)
377
+
378
+ uniq_deps = dependencies.each_with_object({}) { |dep, memo| memo[dep.name] ||= dep }.values
379
+ @dependency_links = uniq_deps.map { |dep| dependency_link(dep) }
380
+ end
381
+
382
+ def dependency_link(dependency)
383
+ if source_url(dependency)
384
+ "[#{dependency.display_name}](#{source_url(dependency)})"
385
+ elsif homepage_url(dependency)
386
+ "[#{dependency.display_name}](#{homepage_url(dependency)})"
387
+ else
388
+ dependency.display_name
368
389
  end
369
390
  end
370
391
 
data/lib/dependabot.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.217.0"
4
+ VERSION = "0.219.0"
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.217.0
4
+ version: 0.219.0
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-24 00:00:00.000000000 Z
11
+ date: 2023-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-codecommit
@@ -84,14 +84,14 @@ dependencies:
84
84
  requirements:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
- version: '1.14'
87
+ version: 1.14.0
88
88
  type: :runtime
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - "~>"
93
93
  - !ruby/object:Gem::Version
94
- version: '1.14'
94
+ version: 1.14.0
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: excon
97
97
  requirement: !ruby/object:Gem::Requirement
@@ -507,8 +507,8 @@ homepage: https://github.com/dependabot/dependabot-core
507
507
  licenses:
508
508
  - Nonstandard
509
509
  metadata:
510
- issue_tracker_uri: https://github.com/dependabot/dependabot-core/issues
511
- changelog_uri: https://github.com/dependabot/dependabot-core/blob/main/CHANGELOG.md
510
+ bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
511
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.219.0
512
512
  post_install_message:
513
513
  rdoc_options: []
514
514
  require_paths: