dependabot-common 0.211.0 → 0.213.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dependabot/clients/azure.rb +1 -1
  3. data/lib/dependabot/clients/bitbucket.rb +10 -3
  4. data/lib/dependabot/config/file.rb +1 -1
  5. data/lib/dependabot/config/ignore_condition.rb +1 -1
  6. data/lib/dependabot/dependency.rb +27 -12
  7. data/lib/dependabot/errors.rb +10 -10
  8. data/lib/dependabot/experiments.rb +19 -0
  9. data/lib/dependabot/file_fetchers/base.rb +146 -83
  10. data/lib/dependabot/file_parsers/base/dependency_set.rb +107 -42
  11. data/lib/dependabot/file_updaters/vendor_updater.rb +2 -0
  12. data/lib/dependabot/git_commit_checker.rb +29 -13
  13. data/lib/dependabot/git_metadata_fetcher.rb +3 -3
  14. data/lib/dependabot/metadata_finders/base/changelog_finder.rb +5 -5
  15. data/lib/dependabot/metadata_finders/base/changelog_pruner.rb +4 -4
  16. data/lib/dependabot/metadata_finders/base/commits_finder.rb +4 -4
  17. data/lib/dependabot/metadata_finders/base/release_finder.rb +4 -4
  18. data/lib/dependabot/pull_request_creator/branch_namer.rb +25 -16
  19. data/lib/dependabot/pull_request_creator/github.rb +5 -5
  20. data/lib/dependabot/pull_request_creator/labeler.rb +8 -6
  21. data/lib/dependabot/pull_request_creator/message_builder/issue_linker.rb +5 -5
  22. data/lib/dependabot/pull_request_creator/message_builder/link_and_mention_sanitizer.rb +34 -6
  23. data/lib/dependabot/pull_request_creator/message_builder/metadata_presenter.rb +11 -13
  24. data/lib/dependabot/pull_request_creator/message_builder.rb +117 -45
  25. data/lib/dependabot/pull_request_creator/pr_name_prefixer.rb +8 -12
  26. data/lib/dependabot/pull_request_creator.rb +6 -3
  27. data/lib/dependabot/pull_request_updater/azure.rb +1 -1
  28. data/lib/dependabot/pull_request_updater/github.rb +16 -13
  29. data/lib/dependabot/pull_request_updater.rb +2 -1
  30. data/lib/dependabot/security_advisory.rb +3 -3
  31. data/lib/dependabot/shared_helpers.rb +12 -12
  32. data/lib/dependabot/source.rb +11 -11
  33. data/lib/dependabot/update_checkers/base.rb +2 -2
  34. data/lib/dependabot/version.rb +1 -1
  35. metadata +17 -44
@@ -17,9 +17,9 @@ require "dependabot/version"
17
17
  module Dependabot
18
18
  module SharedHelpers
19
19
  GIT_CONFIG_GLOBAL_PATH = File.expand_path("~/.gitconfig")
20
- USER_AGENT = "dependabot-core/#{Dependabot::VERSION} "\
21
- "#{Excon::USER_AGENT} ruby/#{RUBY_VERSION} "\
22
- "(#{RUBY_PLATFORM}) "\
20
+ USER_AGENT = "dependabot-core/#{Dependabot::VERSION} " \
21
+ "#{Excon::USER_AGENT} ruby/#{RUBY_VERSION} " \
22
+ "(#{RUBY_PLATFORM}) " \
23
23
  "(+https://github.com/dependabot/dependabot-core)"
24
24
  SIGKILL = 9
25
25
 
@@ -32,7 +32,7 @@ module Dependabot
32
32
  reset_git_repo(repo_contents_path)
33
33
  # Handle missing directories by creating an empty one and relying on the
34
34
  # file fetcher to raise a DependencyFileNotFound error
35
- FileUtils.mkdir_p(path) unless Dir.exist?(path)
35
+ FileUtils.mkdir_p(path)
36
36
  Dir.chdir(path) { yield(path) }
37
37
  else
38
38
  in_a_temporary_directory(directory, &block)
@@ -40,7 +40,7 @@ module Dependabot
40
40
  end
41
41
 
42
42
  def self.in_a_temporary_directory(directory = "/")
43
- Dir.mkdir(Utils::BUMP_TMP_DIR_PATH) unless Dir.exist?(Utils::BUMP_TMP_DIR_PATH)
43
+ FileUtils.mkdir_p(Utils::BUMP_TMP_DIR_PATH)
44
44
  tmp_dir = Dir.mktmpdir(Utils::BUMP_TMP_FILE_PREFIX, Utils::BUMP_TMP_DIR_PATH)
45
45
 
46
46
  begin
@@ -188,7 +188,7 @@ module Dependabot
188
188
  # a wrapper binary that only allows non-mutating commands. Without this,
189
189
  # whenever the credentials are deemed to be invalid, they're erased.
190
190
  run_shell_command(
191
- "git config --global credential.helper "\
191
+ "git config --global credential.helper " \
192
192
  "'!#{credential_helper_path} --file #{Dir.pwd}/git.store'",
193
193
  allow_unsafe_shell_command: true
194
194
  )
@@ -224,7 +224,7 @@ module Dependabot
224
224
  next unless cred["username"] && cred["password"]
225
225
 
226
226
  authenticated_url =
227
- "https://#{cred.fetch('username')}:#{cred.fetch('password')}"\
227
+ "https://#{cred.fetch('username')}:#{cred.fetch('password')}" \
228
228
  "@#{cred.fetch('host')}"
229
229
 
230
230
  git_store_content += authenticated_url + "\n"
@@ -241,23 +241,23 @@ module Dependabot
241
241
  # NOTE: we use --global here (rather than --system) so that Dependabot
242
242
  # can be run without privileged access
243
243
  run_shell_command(
244
- "git config --global --replace-all url.https://#{host}/."\
244
+ "git config --global --replace-all url.https://#{host}/." \
245
245
  "insteadOf ssh://git@#{host}/"
246
246
  )
247
247
  run_shell_command(
248
- "git config --global --add url.https://#{host}/."\
248
+ "git config --global --add url.https://#{host}/." \
249
249
  "insteadOf ssh://git@#{host}:"
250
250
  )
251
251
  run_shell_command(
252
- "git config --global --add url.https://#{host}/."\
252
+ "git config --global --add url.https://#{host}/." \
253
253
  "insteadOf git@#{host}:"
254
254
  )
255
255
  run_shell_command(
256
- "git config --global --add url.https://#{host}/."\
256
+ "git config --global --add url.https://#{host}/." \
257
257
  "insteadOf git@#{host}/"
258
258
  )
259
259
  run_shell_command(
260
- "git config --global --add url.https://#{host}/."\
260
+ "git config --global --add url.https://#{host}/." \
261
261
  "insteadOf git://#{host}/"
262
262
  )
263
263
  end
@@ -7,7 +7,7 @@ module Dependabot
7
7
  (?:\.com)[/:]
8
8
  (?<repo>[\w.-]+/(?:(?!\.git|\.\s)[\w.-])+)
9
9
  (?:(?:/tree|/blob)/(?<branch>[^/]+)/(?<directory>.*)[\#|/])?
10
- }x.freeze
10
+ }x
11
11
 
12
12
  GITHUB_ENTERPRISE_SOURCE = %r{
13
13
  (?<protocol>(http://|https://|git://|ssh://))*
@@ -16,27 +16,27 @@ module Dependabot
16
16
  [/:]
17
17
  (?<repo>[\w.-]+/(?:(?!\.git|\.\s)[\w.-])+)
18
18
  (?:(?:/tree|/blob)/(?<branch>[^/]+)/(?<directory>.*)[\#|/])?
19
- }x.freeze
19
+ }x
20
20
 
21
21
  GITLAB_SOURCE = %r{
22
22
  (?<provider>gitlab)
23
23
  (?:\.com)[/:]
24
- (?<repo>(?!\.git|/tree|/blob)[\w./-]+?)(?:\.git)?
25
- (?:(?:/tree|/blob)/(?<branch>[^/]+)/(?<directory>.*)[\#|/].*)?$
26
- }x.freeze
24
+ (?<repo>[^/]+/(?:(?!\.git)[^/])+((?!/tree|/blob/|/-)/[^/]+)?)
25
+ (?:(?:/tree|/blob)/(?<branch>[^/]+)/(?<directory>.*)[\#|/].*)?
26
+ }x
27
27
 
28
28
  BITBUCKET_SOURCE = %r{
29
29
  (?<provider>bitbucket)
30
30
  (?:\.org)[/:]
31
31
  (?<repo>[\w.-]+/(?:(?!\.git|\.\s)[\w.-])+)
32
32
  (?:(?:/src)/(?<branch>[^/]+)/(?<directory>.*)[\#|/])?
33
- }x.freeze
33
+ }x
34
34
 
35
35
  AZURE_SOURCE = %r{
36
36
  (?<provider>azure)
37
37
  (?:\.com)[/:]
38
38
  (?<repo>[\w.-]+/([\w.-]+/)?(?:_git/)(?:(?!\.git|\.\s)[\w.-])+)
39
- }x.freeze
39
+ }x
40
40
 
41
41
  CODECOMMIT_SOURCE = %r{
42
42
  (?<protocol>(http://|https://|git://|ssh://))
@@ -48,7 +48,7 @@ module Dependabot
48
48
  (?:/)?(?<directory>[^?]*)?
49
49
  [?]?
50
50
  (?<ref>.*)?
51
- }x.freeze
51
+ }x
52
52
 
53
53
  SOURCE_REGEX = /
54
54
  (?:#{GITHUB_SOURCE})|
@@ -56,7 +56,7 @@ module Dependabot
56
56
  (?:#{BITBUCKET_SOURCE})|
57
57
  (?:#{AZURE_SOURCE})|
58
58
  (?:#{CODECOMMIT_SOURCE})
59
- /x.freeze
59
+ /x
60
60
 
61
61
  IGNORED_PROVIDER_HOSTS = %w(gitbox.apache.org svn.apache.org fuchsia.googlesource.com).freeze
62
62
 
@@ -109,8 +109,8 @@ module Dependabot
109
109
  def initialize(provider:, repo:, directory: nil, branch: nil, commit: nil,
110
110
  hostname: nil, api_endpoint: nil)
111
111
  if (hostname.nil? ^ api_endpoint.nil?) && (provider != "codecommit")
112
- msg = "Both hostname and api_endpoint must be specified if either "\
113
- "are. Alternatively, both may be left blank to use the "\
112
+ msg = "Both hostname and api_endpoint must be specified if either " \
113
+ "are. Alternatively, both may be left blank to use the " \
114
114
  "provider's defaults."
115
115
  raise msg
116
116
  end
@@ -120,7 +120,7 @@ module Dependabot
120
120
  Utils.requirement_class_for_package_manager(dependency.package_manager)
121
121
  end
122
122
 
123
- # For some langauges, the manifest file may be constructed such that
123
+ # For some languages, the manifest file may be constructed such that
124
124
  # Dependabot has no way to update it (e.g., if it fetches its versions
125
125
  # from a web API). This method is overridden in those cases.
126
126
  def requirements_unlocked_or_can_be?
@@ -287,7 +287,7 @@ module Dependabot
287
287
 
288
288
  def version_from_requirements
289
289
  @version_from_requirements ||=
290
- dependency.requirements.map { |r| r.fetch(:requirement) }.compact.
290
+ dependency.requirements.filter_map { |r| r.fetch(:requirement) }.
291
291
  flat_map { |req_str| requirement_class.requirements_array(req_str) }.
292
292
  flat_map(&:requirements).
293
293
  reject { |req_array| req_array.first.start_with?("<") }.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.211.0"
4
+ VERSION = "0.213.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.211.0
4
+ version: 0.213.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-23 00:00:00.000000000 Z
11
+ date: 2022-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -132,14 +132,14 @@ dependencies:
132
132
  requirements:
133
133
  - - '='
134
134
  - !ruby/object:Gem::Version
135
- version: 2.3.0
135
+ version: 2.6.0
136
136
  type: :runtime
137
137
  prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - '='
141
141
  - !ruby/object:Gem::Version
142
- version: 2.3.0
142
+ version: 2.6.0
143
143
  - !ruby/object:Gem::Dependency
144
144
  name: gitlab
145
145
  requirement: !ruby/object:Gem::Requirement
@@ -177,7 +177,7 @@ dependencies:
177
177
  version: '4.6'
178
178
  - - "<"
179
179
  - !ruby/object:Gem::Version
180
- version: '6.0'
180
+ version: '7.0'
181
181
  type: :runtime
182
182
  prerelease: false
183
183
  version_requirements: !ruby/object:Gem::Requirement
@@ -187,7 +187,7 @@ dependencies:
187
187
  version: '4.6'
188
188
  - - "<"
189
189
  - !ruby/object:Gem::Version
190
- version: '6.0'
190
+ version: '7.0'
191
191
  - !ruby/object:Gem::Dependency
192
192
  name: parser
193
193
  requirement: !ruby/object:Gem::Requirement
@@ -228,34 +228,6 @@ dependencies:
228
228
  - - "<"
229
229
  - !ruby/object:Gem::Version
230
230
  version: '3.0'
231
- - !ruby/object:Gem::Dependency
232
- name: debase
233
- requirement: !ruby/object:Gem::Requirement
234
- requirements:
235
- - - '='
236
- - !ruby/object:Gem::Version
237
- version: 0.2.3
238
- type: :development
239
- prerelease: false
240
- version_requirements: !ruby/object:Gem::Requirement
241
- requirements:
242
- - - '='
243
- - !ruby/object:Gem::Version
244
- version: 0.2.3
245
- - !ruby/object:Gem::Dependency
246
- name: debase-ruby_core_source
247
- requirement: !ruby/object:Gem::Requirement
248
- requirements:
249
- - - '='
250
- - !ruby/object:Gem::Version
251
- version: 0.10.16
252
- type: :development
253
- prerelease: false
254
- version_requirements: !ruby/object:Gem::Requirement
255
- requirements:
256
- - - '='
257
- - !ruby/object:Gem::Version
258
- version: 0.10.16
259
231
  - !ruby/object:Gem::Dependency
260
232
  name: debug
261
233
  requirement: !ruby/object:Gem::Requirement
@@ -290,14 +262,14 @@ dependencies:
290
262
  requirements:
291
263
  - - "~>"
292
264
  - !ruby/object:Gem::Version
293
- version: 3.11.1
265
+ version: 3.13.0
294
266
  type: :development
295
267
  prerelease: false
296
268
  version_requirements: !ruby/object:Gem::Requirement
297
269
  requirements:
298
270
  - - "~>"
299
271
  - !ruby/object:Gem::Version
300
- version: 3.11.1
272
+ version: 3.13.0
301
273
  - !ruby/object:Gem::Dependency
302
274
  name: rake
303
275
  requirement: !ruby/object:Gem::Requirement
@@ -346,28 +318,28 @@ dependencies:
346
318
  requirements:
347
319
  - - "~>"
348
320
  - !ruby/object:Gem::Version
349
- version: 1.35.1
321
+ version: 1.37.1
350
322
  type: :development
351
323
  prerelease: false
352
324
  version_requirements: !ruby/object:Gem::Requirement
353
325
  requirements:
354
326
  - - "~>"
355
327
  - !ruby/object:Gem::Version
356
- version: 1.35.1
328
+ version: 1.37.1
357
329
  - !ruby/object:Gem::Dependency
358
- name: ruby-debug-ide
330
+ name: rubocop-performance
359
331
  requirement: !ruby/object:Gem::Requirement
360
332
  requirements:
361
333
  - - "~>"
362
334
  - !ruby/object:Gem::Version
363
- version: 0.7.3
335
+ version: 1.15.0
364
336
  type: :development
365
337
  prerelease: false
366
338
  version_requirements: !ruby/object:Gem::Requirement
367
339
  requirements:
368
340
  - - "~>"
369
341
  - !ruby/object:Gem::Version
370
- version: 0.7.3
342
+ version: 1.15.0
371
343
  - !ruby/object:Gem::Dependency
372
344
  name: simplecov
373
345
  requirement: !ruby/object:Gem::Requirement
@@ -461,6 +433,7 @@ files:
461
433
  - lib/dependabot/dependency.rb
462
434
  - lib/dependabot/dependency_file.rb
463
435
  - lib/dependabot/errors.rb
436
+ - lib/dependabot/experiments.rb
464
437
  - lib/dependabot/file_fetchers.rb
465
438
  - lib/dependabot/file_fetchers/README.md
466
439
  - lib/dependabot/file_fetchers/base.rb
@@ -525,14 +498,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
525
498
  requirements:
526
499
  - - ">="
527
500
  - !ruby/object:Gem::Version
528
- version: 2.7.0
501
+ version: 3.1.0
529
502
  required_rubygems_version: !ruby/object:Gem::Requirement
530
503
  requirements:
531
504
  - - ">="
532
505
  - !ruby/object:Gem::Version
533
- version: 2.7.3
506
+ version: 3.3.22
534
507
  requirements: []
535
- rubygems_version: 3.1.6
508
+ rubygems_version: 3.3.7
536
509
  signing_key:
537
510
  specification_version: 4
538
511
  summary: Shared code used between Dependabot package managers