dependabot-npm_and_yarn 0.334.0 → 0.335.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 +4 -4
- data/lib/dependabot/npm_and_yarn/constraint_helper.rb +30 -21
- data/lib/dependabot/npm_and_yarn/dependency_files_filterer.rb +12 -6
- data/lib/dependabot/npm_and_yarn/file_fetcher/path_dependency_builder.rb +21 -13
- data/lib/dependabot/npm_and_yarn/file_fetcher.rb +14 -7
- data/lib/dependabot/npm_and_yarn/file_parser.rb +84 -44
- data/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb +18 -10
- data/lib/dependabot/npm_and_yarn/file_updater/package_json_updater.rb +16 -8
- data/lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb +4 -2
- data/lib/dependabot/npm_and_yarn/file_updater/pnpm_workspace_updater.rb +5 -3
- data/lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb +42 -25
- data/lib/dependabot/npm_and_yarn/file_updater.rb +4 -2
- data/lib/dependabot/npm_and_yarn/metadata_finder.rb +2 -2
- data/lib/dependabot/npm_and_yarn/npm_package_manager.rb +9 -6
- data/lib/dependabot/npm_and_yarn/package/registry_finder.rb +10 -2
- data/lib/dependabot/npm_and_yarn/package_manager.rb +9 -6
- data/lib/dependabot/npm_and_yarn/package_name.rb +2 -1
- data/lib/dependabot/npm_and_yarn/pnpm_package_manager.rb +9 -6
- data/lib/dependabot/npm_and_yarn/update_checker/subdependency_version_resolver.rb +8 -2
- data/lib/dependabot/npm_and_yarn/update_checker/version_resolver.rb +23 -8
- data/lib/dependabot/npm_and_yarn/update_checker/vulnerability_auditor.rb +4 -2
- data/lib/dependabot/npm_and_yarn/update_checker.rb +17 -7
- data/lib/dependabot/npm_and_yarn/version.rb +17 -14
- data/lib/dependabot/npm_and_yarn/yarn_package_manager.rb +9 -6
- data/lib/dependabot/npm_and_yarn.rb +435 -406
- metadata +12 -12
@@ -93,10 +93,13 @@ module Dependabot
|
|
93
93
|
YARN_PACKAGE_NOT_FOUND_CODE_1 = /Couldn't find package "[^@].*(?<dep>.*)" on the "(?<regis>.*)" registry./
|
94
94
|
YARN_PACKAGE_NOT_FOUND_CODE_2 = /Couldn't find package "[^@].*(?<dep>.*)" required by "(?<pkg>.*)" on the "(?<regis>.*)" registry./ # rubocop:disable Layout/LineLength
|
95
95
|
|
96
|
-
YN0035 = T.let(
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
YN0035 = T.let(
|
97
|
+
{
|
98
|
+
PACKAGE_NOT_FOUND: %r{(?<package_req>@[\w-]+\/[\w-]+@\S+): Package not found},
|
99
|
+
FAILED_TO_RETRIEVE: %r{(?<package_req>@[\w-]+\/[\w-]+@\S+): The remote server failed to provide the requested resource} # rubocop:disable Layout/LineLength
|
100
|
+
}.freeze,
|
101
|
+
T::Hash[String, Regexp]
|
102
|
+
)
|
100
103
|
|
101
104
|
YN0082_PACKAGE_NOT_FOUND_REGEX = /YN0082:.*?(\S+@\S+): No candidates found/
|
102
105
|
|
@@ -146,32 +149,47 @@ module Dependabot
|
|
146
149
|
# if not package found with specified version
|
147
150
|
YARN_PACKAGE_NOT_FOUND = /MessageError: Couldn't find any versions for "(?<pkg>.*?)" that matches "(?<ver>.*?)"/
|
148
151
|
|
149
|
-
YN0001_DEPS_RESOLUTION_FAILED = T.let(
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
152
|
+
YN0001_DEPS_RESOLUTION_FAILED = T.let(
|
153
|
+
{
|
154
|
+
DEPS_INCORRECT_MET: /peer dependencies are incorrectly met/
|
155
|
+
}.freeze,
|
156
|
+
T::Hash[String, Regexp]
|
157
|
+
)
|
158
|
+
|
159
|
+
YN0001_FILE_NOT_RESOLVED_CODES = T.let(
|
160
|
+
{
|
161
|
+
FIND_PACKAGE_LOCATION: /YN0001:(.*?)UsageError: Couldn't find the (?<pkg>.*) state file/,
|
162
|
+
NO_CANDIDATE_FOUND: /YN0001:(.*?)Error: (?<pkg>.*): No candidates found/,
|
163
|
+
NO_SUPPORTED_RESOLVER: /YN0001:(.*?)Error: (?<pkg>.*) isn't supported by any available resolver/,
|
164
|
+
WORKSPACE_NOT_FOUND: /YN0001:(.*?)Error: (?<pkg>.*): Workspace not found/,
|
165
|
+
ENOENT: /YN0001:(.*?)Thrown Error: (?<pkg>.*) ENOENT/,
|
166
|
+
MANIFEST_NOT_FOUND: /YN0001:(.*?)Error: (?<pkg>.*): Manifest not found/,
|
167
|
+
LIBZIP_ERROR: /YN0001:(.*?)Libzip Error: Failed to open the cache entry for (?<pkg>.*): Not a zip archive/
|
168
|
+
}.freeze,
|
169
|
+
T::Hash[String, Regexp]
|
170
|
+
)
|
171
|
+
|
172
|
+
YN0001_AUTH_ERROR_CODES = T.let(
|
173
|
+
{
|
174
|
+
AUTH_ERROR: /YN0001:*.*Fatal Error: could not read Username for '(?<url>.*)': terminal prompts disabled/
|
175
|
+
}.freeze,
|
176
|
+
T::Hash[String, Regexp]
|
177
|
+
)
|
178
|
+
|
179
|
+
YN0001_REQ_NOT_FOUND_CODES = T.let(
|
180
|
+
{
|
181
|
+
REQUIREMENT_NOT_SATISFIED: /provides (?<dep>.*)(.*?)with version (?<ver>.*), which doesn't satisfy what (?<pkg>.*) requests/, # rubocop:disable Layout/LineLength
|
182
|
+
REQUIREMENT_NOT_PROVIDED: /(?<dep>.*)(.*?)doesn't provide (?<pkg>.*)(.*?), requested by (?<parent>.*)/
|
183
|
+
}.freeze,
|
184
|
+
T::Hash[String, Regexp]
|
185
|
+
)
|
186
|
+
|
187
|
+
YN0001_INVALID_TYPE_ERRORS = T.let(
|
188
|
+
{
|
189
|
+
INVALID_URL: /TypeError: (?<dep>.*): Invalid URL/
|
190
|
+
}.freeze,
|
191
|
+
T::Hash[String, Regexp]
|
192
|
+
)
|
175
193
|
|
176
194
|
YN0086_DEPS_RESOLUTION_FAILED = /peer dependencies are incorrectly met/
|
177
195
|
|
@@ -214,421 +232,432 @@ module Dependabot
|
|
214
232
|
end
|
215
233
|
|
216
234
|
YARN_CODE_REGEX = /(YN\d{4})/
|
217
|
-
YARN_ERROR_CODES = T.let(
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
235
|
+
YARN_ERROR_CODES = T.let(
|
236
|
+
{
|
237
|
+
"YN0001" => {
|
238
|
+
message: "Exception error",
|
239
|
+
handler: lambda { |message, _error, _params|
|
240
|
+
YN0001_FILE_NOT_RESOLVED_CODES.each do |(_yn0001_key, yn0001_regex)|
|
241
|
+
if (msg = message.match(yn0001_regex))
|
242
|
+
return Dependabot::DependencyFileNotResolvable.new(msg)
|
243
|
+
end
|
224
244
|
end
|
225
|
-
end
|
226
245
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
246
|
+
YN0001_AUTH_ERROR_CODES.each do |(_yn0001_key, yn0001_regex)|
|
247
|
+
if (msg = message.match(yn0001_regex))
|
248
|
+
url = msg.named_captures.fetch(URL_CAPTURE)
|
249
|
+
return Dependabot::PrivateSourceAuthenticationFailure.new(url)
|
250
|
+
end
|
231
251
|
end
|
232
|
-
end
|
233
252
|
|
234
|
-
|
235
|
-
|
236
|
-
|
253
|
+
YN0001_REQ_NOT_FOUND_CODES.each do |(_yn0001_key, yn0001_regex)|
|
254
|
+
if (msg = message.match(yn0001_regex))
|
255
|
+
return Dependabot::DependencyFileNotResolvable.new(msg)
|
256
|
+
end
|
237
257
|
end
|
238
|
-
end
|
239
258
|
|
240
|
-
|
241
|
-
|
242
|
-
|
259
|
+
YN0001_DEPS_RESOLUTION_FAILED.each do |(_yn0001_key, yn0001_regex)|
|
260
|
+
if (msg = message.match(yn0001_regex))
|
261
|
+
return Dependabot::DependencyFileNotResolvable.new(msg)
|
262
|
+
end
|
243
263
|
end
|
244
|
-
end
|
245
264
|
|
246
|
-
|
247
|
-
|
265
|
+
YN0001_INVALID_TYPE_ERRORS.each do |(_yn0001_key, yn0001_regex)|
|
266
|
+
if (msg = message.match(yn0001_regex))
|
248
267
|
|
249
|
-
|
268
|
+
return Dependabot::DependencyFileNotResolvable.new(msg)
|
269
|
+
end
|
250
270
|
end
|
251
|
-
end
|
252
271
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
272
|
+
Dependabot::DependabotError.new(message)
|
273
|
+
}
|
274
|
+
},
|
275
|
+
"YN0002" => {
|
276
|
+
message: "Missing peer dependency",
|
277
|
+
handler: lambda { |message, _error, _params|
|
278
|
+
Dependabot::DependencyFileNotResolvable.new(message)
|
279
|
+
}
|
280
|
+
},
|
281
|
+
"YN0009" => {
|
282
|
+
message: "Build Failed",
|
283
|
+
handler: lambda { |message, _error, _params|
|
284
|
+
Dependabot::DependencyFileNotResolvable.new(message)
|
285
|
+
}
|
286
|
+
},
|
287
|
+
"YN0016" => {
|
288
|
+
message: "Remote not found",
|
289
|
+
handler: lambda { |message, _error, _params|
|
290
|
+
Dependabot::GitDependenciesNotReachable.new(message)
|
291
|
+
}
|
292
|
+
},
|
293
|
+
"YN0020" => {
|
294
|
+
message: "Missing lockfile entry",
|
295
|
+
handler: lambda { |message, _error, _params|
|
296
|
+
Dependabot::DependencyFileNotFound.new(message)
|
297
|
+
}
|
298
|
+
},
|
299
|
+
"YN0035" => {
|
300
|
+
message: "Package not found",
|
301
|
+
handler: lambda { |message, _error, _params|
|
302
|
+
YN0035.each do |(_yn0035_key, yn0035_regex)|
|
303
|
+
if (match_data = message.match(yn0035_regex)) && (package_req = match_data[:package_req])
|
304
|
+
return Dependabot::DependencyNotFound.new(
|
305
|
+
"#{package_req} Detail: #{message}"
|
306
|
+
)
|
307
|
+
end
|
288
308
|
end
|
289
|
-
end
|
290
|
-
Dependabot::DependencyNotFound.new(message)
|
291
|
-
}
|
292
|
-
},
|
293
|
-
"YN0041" => {
|
294
|
-
message: "Invalid authentication",
|
295
|
-
handler: lambda { |message, _error, _params|
|
296
|
-
url = T.must(URI.decode_www_form_component(message).split("https://").last).split("/").first
|
297
|
-
Dependabot::PrivateSourceAuthenticationFailure.new(url)
|
298
|
-
}
|
299
|
-
},
|
300
|
-
"YN0046" => {
|
301
|
-
message: "Automerge failed to parse",
|
302
|
-
handler: lambda { |message, _error, _params|
|
303
|
-
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
304
|
-
}
|
305
|
-
},
|
306
|
-
"YN0047" => {
|
307
|
-
message: "Automerge immutable",
|
308
|
-
handler: lambda { |message, _error, _params|
|
309
|
-
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
310
|
-
}
|
311
|
-
},
|
312
|
-
"YN0062" => {
|
313
|
-
message: "Incompatible OS",
|
314
|
-
handler: lambda { |message, _error, _params|
|
315
|
-
Dependabot::DependabotError.new(message)
|
316
|
-
}
|
317
|
-
},
|
318
|
-
"YN0063" => {
|
319
|
-
message: "Incompatible CPU",
|
320
|
-
handler: lambda { |message, _error, _params|
|
321
|
-
Dependabot::IncompatibleCPU.new(message)
|
322
|
-
}
|
323
|
-
},
|
324
|
-
"YN0068" => {
|
325
|
-
message: "No matching package",
|
326
|
-
handler: lambda { |message, _error, _params|
|
327
|
-
Dependabot::DependencyFileNotResolvable.new(message)
|
328
|
-
}
|
329
|
-
},
|
330
|
-
"YN0071" => {
|
331
|
-
message: "NM can't install external soft link",
|
332
|
-
handler: lambda { |message, _error, _params|
|
333
|
-
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
334
|
-
}
|
335
|
-
},
|
336
|
-
"YN0072" => {
|
337
|
-
message: "NM preserve symlinks required",
|
338
|
-
handler: lambda { |message, _error, _params|
|
339
|
-
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
340
|
-
}
|
341
|
-
},
|
342
|
-
"YN0075" => {
|
343
|
-
message: "Prolog instantiation error",
|
344
|
-
handler: lambda { |message, _error, _params|
|
345
|
-
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
346
|
-
}
|
347
|
-
},
|
348
|
-
"YN0077" => {
|
349
|
-
message: "Ghost architecture",
|
350
|
-
handler: lambda { |message, _error, _params|
|
351
|
-
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
352
|
-
}
|
353
|
-
},
|
354
|
-
"YN0080" => {
|
355
|
-
message: "Network disabled",
|
356
|
-
handler: lambda { |message, _error, _params|
|
357
|
-
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
358
|
-
}
|
359
|
-
},
|
360
|
-
"YN0081" => {
|
361
|
-
message: "Network unsafe HTTP",
|
362
|
-
handler: lambda { |message, _error, _params|
|
363
|
-
Dependabot::NetworkUnsafeHTTP.new(message)
|
364
|
-
}
|
365
|
-
},
|
366
|
-
"YN0082" => {
|
367
|
-
message: "No candidates found",
|
368
|
-
handler: lambda { |message, _error, _params|
|
369
|
-
match_data = message.match(YN0082_PACKAGE_NOT_FOUND_REGEX)
|
370
|
-
if match_data
|
371
|
-
package_req = match_data[1]
|
372
|
-
Dependabot::DependencyNotFound.new("#{package_req} Detail: #{message}")
|
373
|
-
else
|
374
309
|
Dependabot::DependencyNotFound.new(message)
|
375
|
-
|
376
|
-
}
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
310
|
+
}
|
311
|
+
},
|
312
|
+
"YN0041" => {
|
313
|
+
message: "Invalid authentication",
|
314
|
+
handler: lambda { |message, _error, _params|
|
315
|
+
url = T.must(URI.decode_www_form_component(message).split("https://").last).split("/").first
|
316
|
+
Dependabot::PrivateSourceAuthenticationFailure.new(url)
|
317
|
+
}
|
318
|
+
},
|
319
|
+
"YN0046" => {
|
320
|
+
message: "Automerge failed to parse",
|
321
|
+
handler: lambda { |message, _error, _params|
|
322
|
+
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
323
|
+
}
|
324
|
+
},
|
325
|
+
"YN0047" => {
|
326
|
+
message: "Automerge immutable",
|
327
|
+
handler: lambda { |message, _error, _params|
|
328
|
+
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
329
|
+
}
|
330
|
+
},
|
331
|
+
"YN0062" => {
|
332
|
+
message: "Incompatible OS",
|
333
|
+
handler: lambda { |message, _error, _params|
|
334
|
+
Dependabot::DependabotError.new(message)
|
335
|
+
}
|
336
|
+
},
|
337
|
+
"YN0063" => {
|
338
|
+
message: "Incompatible CPU",
|
339
|
+
handler: lambda { |message, _error, _params|
|
340
|
+
Dependabot::IncompatibleCPU.new(message)
|
341
|
+
}
|
342
|
+
},
|
343
|
+
"YN0068" => {
|
344
|
+
message: "No matching package",
|
345
|
+
handler: lambda { |message, _error, _params|
|
346
|
+
Dependabot::DependencyFileNotResolvable.new(message)
|
347
|
+
}
|
348
|
+
},
|
349
|
+
"YN0071" => {
|
350
|
+
message: "NM can't install external soft link",
|
351
|
+
handler: lambda { |message, _error, _params|
|
352
|
+
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
353
|
+
}
|
354
|
+
},
|
355
|
+
"YN0072" => {
|
356
|
+
message: "NM preserve symlinks required",
|
357
|
+
handler: lambda { |message, _error, _params|
|
358
|
+
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
359
|
+
}
|
360
|
+
},
|
361
|
+
"YN0075" => {
|
362
|
+
message: "Prolog instantiation error",
|
363
|
+
handler: lambda { |message, _error, _params|
|
364
|
+
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
365
|
+
}
|
366
|
+
},
|
367
|
+
"YN0077" => {
|
368
|
+
message: "Ghost architecture",
|
369
|
+
handler: lambda { |message, _error, _params|
|
370
|
+
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
371
|
+
}
|
372
|
+
},
|
373
|
+
"YN0080" => {
|
374
|
+
message: "Network disabled",
|
375
|
+
handler: lambda { |message, _error, _params|
|
376
|
+
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
377
|
+
}
|
378
|
+
},
|
379
|
+
"YN0081" => {
|
380
|
+
message: "Network unsafe HTTP",
|
381
|
+
handler: lambda { |message, _error, _params|
|
382
|
+
Dependabot::NetworkUnsafeHTTP.new(message)
|
383
|
+
}
|
384
|
+
},
|
385
|
+
"YN0082" => {
|
386
|
+
message: "No candidates found",
|
387
|
+
handler: lambda { |message, _error, _params|
|
388
|
+
match_data = message.match(YN0082_PACKAGE_NOT_FOUND_REGEX)
|
389
|
+
if match_data
|
390
|
+
package_req = match_data[1]
|
391
|
+
Dependabot::DependencyNotFound.new("#{package_req} Detail: #{message}")
|
392
|
+
else
|
393
|
+
Dependabot::DependencyNotFound.new(message)
|
394
|
+
end
|
395
|
+
}
|
396
|
+
},
|
397
|
+
"YN0086" => {
|
398
|
+
message: "deps resolution failed",
|
399
|
+
handler: lambda { |message, _error, _params|
|
400
|
+
msg = message.match(YN0086_DEPS_RESOLUTION_FAILED)
|
401
|
+
Dependabot::DependencyFileNotResolvable.new(msg || message)
|
402
|
+
}
|
383
403
|
}
|
384
|
-
}
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
404
|
+
}.freeze,
|
405
|
+
T::Hash[String,
|
406
|
+
{
|
407
|
+
message: T.any(String, NilClass),
|
408
|
+
handler: ErrorHandler
|
409
|
+
}]
|
410
|
+
)
|
389
411
|
|
390
412
|
# Group of patterns to validate error message and raise specific error
|
391
|
-
VALIDATION_GROUP_PATTERNS = T.let(
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
413
|
+
VALIDATION_GROUP_PATTERNS = T.let(
|
414
|
+
[
|
415
|
+
{
|
416
|
+
patterns: [INVALID_NAME_IN_PACKAGE_JSON],
|
417
|
+
handler: lambda { |message, _error, _params|
|
418
|
+
Dependabot::DependencyFileNotResolvable.new(message)
|
419
|
+
},
|
420
|
+
in_usage: false,
|
421
|
+
matchfn: nil
|
396
422
|
},
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
params[:dependencies],
|
408
|
-
params[:yarn_lock]
|
423
|
+
{
|
424
|
+
# Check if sub dependency is using local path and raise a resolvability error
|
425
|
+
patterns: [INVALID_PACKAGE_REGEX, SUB_DEP_LOCAL_PATH_TEXT],
|
426
|
+
handler: lambda { |message, _error, params|
|
427
|
+
Dependabot::DependencyFileNotResolvable.new(
|
428
|
+
Utils.sanitize_resolvability_message(
|
429
|
+
message,
|
430
|
+
params[:dependencies],
|
431
|
+
params[:yarn_lock]
|
432
|
+
)
|
409
433
|
)
|
410
|
-
|
434
|
+
},
|
435
|
+
in_usage: false,
|
436
|
+
matchfn: nil
|
411
437
|
},
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
438
|
+
{
|
439
|
+
patterns: [NODE_MODULES_STATE_FILE_NOT_FOUND],
|
440
|
+
handler: lambda { |message, _error, _params|
|
441
|
+
Dependabot::MisconfiguredTooling.new("Yarn", message)
|
442
|
+
},
|
443
|
+
in_usage: true,
|
444
|
+
matchfn: nil
|
419
445
|
},
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
446
|
+
{
|
447
|
+
patterns: [TARBALL_IS_NOT_IN_NETWORK],
|
448
|
+
handler: lambda { |message, _error, _params|
|
449
|
+
Dependabot::DependencyFileNotResolvable.new(message)
|
450
|
+
},
|
451
|
+
in_usage: false,
|
452
|
+
matchfn: nil
|
427
453
|
},
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
454
|
+
{
|
455
|
+
patterns: [NODE_VERSION_NOT_SATISFY_REGEX],
|
456
|
+
handler: lambda { |message, _error, _params|
|
457
|
+
versions = Utils.extract_node_versions(message)
|
458
|
+
current_version = versions[:current_version]
|
459
|
+
required_version = versions[:required_version]
|
460
|
+
|
461
|
+
return Dependabot::DependabotError.new(message) unless current_version && required_version
|
462
|
+
|
463
|
+
Dependabot::ToolVersionNotSupported.new("Yarn", current_version, required_version)
|
464
|
+
},
|
465
|
+
in_usage: false,
|
466
|
+
matchfn: nil
|
441
467
|
},
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
},
|
451
|
-
in_usage: false,
|
452
|
-
matchfn: nil
|
453
|
-
},
|
454
|
-
{
|
455
|
-
patterns: [DEPENDENCY_FILE_NOT_RESOLVABLE],
|
456
|
-
handler: lambda { |message, _error, _params|
|
457
|
-
DependencyFileNotResolvable.new(message)
|
468
|
+
{
|
469
|
+
patterns: [AUTHENTICATION_TOKEN_NOT_PROVIDED, AUTHENTICATION_IS_NOT_CONFIGURED,
|
470
|
+
AUTHENTICATION_HEADER_NOT_PROVIDED],
|
471
|
+
handler: lambda { |message, _error, _params|
|
472
|
+
Dependabot::PrivateSourceAuthenticationFailure.new(message)
|
473
|
+
},
|
474
|
+
in_usage: false,
|
475
|
+
matchfn: nil
|
458
476
|
},
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
Dependabot::MissingEnvironmentVariable.new(var, message)
|
477
|
+
{
|
478
|
+
patterns: [DEPENDENCY_FILE_NOT_RESOLVABLE],
|
479
|
+
handler: lambda { |message, _error, _params|
|
480
|
+
DependencyFileNotResolvable.new(message)
|
481
|
+
},
|
482
|
+
in_usage: false,
|
483
|
+
matchfn: nil
|
468
484
|
},
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
485
|
+
{
|
486
|
+
patterns: [ENV_VAR_NOT_RESOLVABLE],
|
487
|
+
handler: lambda { |message, _error, _params|
|
488
|
+
var = Utils.extract_var(message)
|
489
|
+
|
490
|
+
Dependabot::MissingEnvironmentVariable.new(var, message)
|
491
|
+
},
|
492
|
+
in_usage: false,
|
493
|
+
matchfn: nil
|
476
494
|
},
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
Dependabot::GitDependenciesNotReachable.new(dependency_url)
|
495
|
+
{
|
496
|
+
patterns: [ONLY_PRIVATE_WORKSPACE_TEXT],
|
497
|
+
handler: lambda { |message, _error, _params|
|
498
|
+
Dependabot::DependencyFileNotEvaluatable.new(message)
|
499
|
+
},
|
500
|
+
in_usage: false,
|
501
|
+
matchfn: nil
|
486
502
|
},
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
503
|
+
{
|
504
|
+
patterns: [UNREACHABLE_GIT_CHECK_REGEX],
|
505
|
+
handler: lambda { |message, _error, _params|
|
506
|
+
dependency_url = message.match(UNREACHABLE_GIT_CHECK_REGEX).named_captures.fetch(URL_CAPTURE)
|
507
|
+
|
508
|
+
Dependabot::GitDependenciesNotReachable.new(dependency_url)
|
509
|
+
},
|
510
|
+
in_usage: false,
|
511
|
+
matchfn: nil
|
496
512
|
},
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
513
|
+
{
|
514
|
+
patterns: [SOCKET_HANG_UP],
|
515
|
+
handler: lambda { |message, _error, _params|
|
516
|
+
url = message.match(SOCKET_HANG_UP).named_captures.fetch(URL_CAPTURE)
|
517
|
+
|
518
|
+
Dependabot::PrivateSourceTimedOut.new(url.gsub(HTTP_CHECK_REGEX, ""))
|
519
|
+
},
|
520
|
+
in_usage: false,
|
521
|
+
matchfn: nil
|
506
522
|
},
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
523
|
+
{
|
524
|
+
patterns: [ESOCKETTIMEDOUT],
|
525
|
+
handler: lambda { |message, _error, _params|
|
526
|
+
package_req = message.match(ESOCKETTIMEDOUT).named_captures.fetch("package")
|
527
|
+
|
528
|
+
Dependabot::PrivateSourceTimedOut.new(package_req.gsub(HTTP_CHECK_REGEX, ""))
|
529
|
+
},
|
530
|
+
in_usage: false,
|
531
|
+
matchfn: nil
|
514
532
|
},
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
msg = "Error while loading \"#{filename.split('/').last}\"."
|
524
|
-
Dependabot::DependencyFileNotResolvable.new(msg)
|
533
|
+
{
|
534
|
+
patterns: [OUT_OF_DISKSPACE],
|
535
|
+
handler: lambda { |message, _error, _params|
|
536
|
+
Dependabot::OutOfDisk.new(message)
|
537
|
+
},
|
538
|
+
in_usage: false,
|
539
|
+
matchfn: nil
|
525
540
|
},
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
541
|
+
{
|
542
|
+
patterns: [YARNRC_PARSE_ERROR],
|
543
|
+
handler: lambda { |message, _error, _params|
|
544
|
+
filename = message.match(YARNRC_PARSE_ERROR).named_captures["filename"]
|
545
|
+
|
546
|
+
msg = "Error while loading \"#{filename.split('/').last}\"."
|
547
|
+
Dependabot::DependencyFileNotResolvable.new(msg)
|
548
|
+
},
|
549
|
+
in_usage: false,
|
550
|
+
matchfn: nil
|
551
|
+
},
|
552
|
+
{
|
553
|
+
patterns: [YARNRC_ENV_NOT_FOUND],
|
554
|
+
handler: lambda { |message, _error, _params|
|
555
|
+
error_message = message.gsub(/[[:space:]]+/, " ").strip
|
533
556
|
|
534
|
-
|
535
|
-
|
557
|
+
filename = error_message.match(YARNRC_ENV_NOT_FOUND_REGEX)
|
558
|
+
.named_captures["filename"]
|
536
559
|
|
537
|
-
|
538
|
-
|
560
|
+
env_var = error_message.match(YARNRC_ENV_NOT_FOUND_REGEX)
|
561
|
+
.named_captures["token"]
|
539
562
|
|
540
|
-
|
541
|
-
|
563
|
+
msg = "Environment variable \"#{env_var}\" not found in \"#{filename.split('/').last}\"."
|
564
|
+
Dependabot::MissingEnvironmentVariable.new(env_var, msg)
|
565
|
+
},
|
566
|
+
in_usage: false,
|
567
|
+
matchfn: nil
|
542
568
|
},
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
569
|
+
{
|
570
|
+
patterns: [YARNRC_EAI_AGAIN],
|
571
|
+
handler: lambda { |_message, _error, _params|
|
572
|
+
Dependabot::DependencyFileNotResolvable.new("Network error while resolving dependency.")
|
573
|
+
},
|
574
|
+
in_usage: false,
|
575
|
+
matchfn: nil
|
550
576
|
},
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
577
|
+
{
|
578
|
+
patterns: [YARNRC_ENOENT],
|
579
|
+
handler: lambda { |message, _error, _params|
|
580
|
+
error_message = message.gsub(/[[:space:]]+/, " ").strip
|
581
|
+
filename = error_message.match(YARNRC_ENOENT_REGEX).named_captures["filename"]
|
582
|
+
|
583
|
+
Dependabot::DependencyFileNotResolvable.new(
|
584
|
+
"Internal error while resolving dependency." \
|
585
|
+
"File not found \"#{filename.split('/').last}\""
|
586
|
+
)
|
587
|
+
},
|
588
|
+
in_usage: false,
|
589
|
+
matchfn: nil
|
562
590
|
},
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
591
|
+
{
|
592
|
+
patterns: [YARN_PACKAGE_NOT_FOUND],
|
593
|
+
handler: lambda { |message, _error, _params|
|
594
|
+
package_name = message.match(YARN_PACKAGE_NOT_FOUND).named_captures["pkg"]
|
595
|
+
version = message.match(YARN_PACKAGE_NOT_FOUND).named_captures["ver"]
|
596
|
+
|
597
|
+
Dependabot::InconsistentRegistryResponse.new(
|
598
|
+
"Couldn't find any versions for \"#{package_name}\" that " \
|
599
|
+
"matches \"#{version}\""
|
600
|
+
)
|
601
|
+
},
|
602
|
+
in_usage: false,
|
603
|
+
matchfn: nil
|
574
604
|
},
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
605
|
+
{
|
606
|
+
patterns: [YARN_PACKAGE_NOT_FOUND_CODE, YARN_PACKAGE_NOT_FOUND_CODE_1, YARN_PACKAGE_NOT_FOUND_CODE_2],
|
607
|
+
handler: lambda { |message, _error, _params|
|
608
|
+
msg = message.match(YARN_PACKAGE_NOT_FOUND_CODE) || message.match(YARN_PACKAGE_NOT_FOUND_CODE_1) ||
|
609
|
+
message.match(YARN_PACKAGE_NOT_FOUND_CODE_2)
|
610
|
+
|
611
|
+
Dependabot::DependencyFileNotResolvable.new(msg)
|
612
|
+
},
|
613
|
+
in_usage: false,
|
614
|
+
matchfn: nil
|
585
615
|
},
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
616
|
+
{
|
617
|
+
patterns: [REQUEST_ERROR_E403, AUTH_REQUIRED_ERROR, PERMISSION_DENIED, BAD_REQUEST],
|
618
|
+
handler: lambda { |message, _error, _params|
|
619
|
+
dependency_url = T.must(URI.decode_www_form_component(message).split("https://").last).split("/").first
|
620
|
+
|
621
|
+
Dependabot::PrivateSourceAuthenticationFailure.new(dependency_url)
|
622
|
+
},
|
623
|
+
in_usage: false,
|
624
|
+
matchfn: nil
|
595
625
|
},
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
},
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
},
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
}
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
}])
|
626
|
+
{
|
627
|
+
patterns: [MANIFEST_NOT_FOUND],
|
628
|
+
handler: lambda { |message, _error, _params|
|
629
|
+
msg = message.match(MANIFEST_NOT_FOUND)
|
630
|
+
Dependabot::DependencyFileNotResolvable.new(msg)
|
631
|
+
},
|
632
|
+
in_usage: false,
|
633
|
+
matchfn: nil
|
634
|
+
},
|
635
|
+
{
|
636
|
+
patterns: [INTERNAL_SERVER_ERROR],
|
637
|
+
handler: lambda { |message, _error, _params|
|
638
|
+
msg = message.match(INTERNAL_SERVER_ERROR)
|
639
|
+
Dependabot::DependencyFileNotResolvable.new(msg)
|
640
|
+
},
|
641
|
+
in_usage: false,
|
642
|
+
matchfn: nil
|
643
|
+
},
|
644
|
+
{
|
645
|
+
patterns: [REGISTRY_NOT_REACHABLE],
|
646
|
+
handler: lambda { |message, _error, _params|
|
647
|
+
msg = message.match(REGISTRY_NOT_REACHABLE)
|
648
|
+
Dependabot::DependencyFileNotResolvable.new(msg)
|
649
|
+
},
|
650
|
+
in_usage: false,
|
651
|
+
matchfn: nil
|
652
|
+
}
|
653
|
+
].freeze,
|
654
|
+
T::Array[{
|
655
|
+
patterns: T::Array[T.any(String, Regexp)],
|
656
|
+
handler: ErrorHandler,
|
657
|
+
in_usage: T.nilable(T::Boolean),
|
658
|
+
matchfn: T.nilable(T.proc.params(usage: String, message: String).returns(T::Boolean))
|
659
|
+
}]
|
660
|
+
)
|
632
661
|
end
|
633
662
|
# rubocop:enable Metrics/ModuleLength
|
634
663
|
end
|