dependabot-common 0.401.0 → 0.403.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/errors.rb +28 -0
- data/lib/dependabot/file_updaters/artifact_updater.rb +33 -7
- data/lib/dependabot.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a258c6dc5f27617a53546bc62d7cc32fd79e45537f4f3faeab967c9e94641b8
|
|
4
|
+
data.tar.gz: f1e203208a54733408e4b94c793185108349db7a493a0be78e2103754fabcfc5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2fb50fc39f60920d8889db4720c138a13c3de8737527c0c1426934789635a9a531d2ae9436a0974dc1744d6d4955c68c5d4ff2b8f08b6431c62fda38d207bbdf
|
|
7
|
+
data.tar.gz: 720e7093f19d80501c4bdac6819aff9e86ff61b9725df3f874729f8726437cf1ed7712e5c12bf8fab3e1ec6bb6beb115329fcd1654eec52372ccb9d92df3c5c4
|
data/lib/dependabot/errors.rb
CHANGED
|
@@ -256,6 +256,13 @@ module Dependabot
|
|
|
256
256
|
"error-type": "dependency_file_not_resolvable",
|
|
257
257
|
"error-detail": { message: error.message }
|
|
258
258
|
}
|
|
259
|
+
# TODO: switch to a dedicated error type once dependabot-api accepts one.
|
|
260
|
+
# Until then, reuse a type whose message is shown to users.
|
|
261
|
+
when Dependabot::DependencyChecksumMismatch
|
|
262
|
+
{
|
|
263
|
+
"error-type": "dependency_file_not_resolvable",
|
|
264
|
+
"error-detail": { message: error.message }
|
|
265
|
+
}
|
|
259
266
|
when Dependabot::BranchNameFormattingError
|
|
260
267
|
{
|
|
261
268
|
"error-type": "branch_name_formatting_error",
|
|
@@ -720,6 +727,27 @@ module Dependabot
|
|
|
720
727
|
|
|
721
728
|
class DependencyFileContentNotChanged < DependabotError; end
|
|
722
729
|
|
|
730
|
+
# Raised when the package manager refuses to continue because two sources
|
|
731
|
+
# (e.g. a lockfile and a registry) report different checksums for the same
|
|
732
|
+
# dependency version. It deliberately does not inherit from
|
|
733
|
+
# DependencyFileNotResolvable: callers that treat "not resolvable" as "no
|
|
734
|
+
# update available" must not hide this error.
|
|
735
|
+
class DependencyChecksumMismatch < DependabotError
|
|
736
|
+
extend T::Sig
|
|
737
|
+
|
|
738
|
+
# The dependency as the package manager names it, including any platform
|
|
739
|
+
# suffix (e.g. "nokogiri (1.16.0-x86_64-linux)"). Nil when it can't be
|
|
740
|
+
# determined.
|
|
741
|
+
sig { returns(T.nilable(String)) }
|
|
742
|
+
attr_reader :dependency_name
|
|
743
|
+
|
|
744
|
+
sig { params(message: String, dependency_name: T.nilable(String)).void }
|
|
745
|
+
def initialize(message, dependency_name: nil)
|
|
746
|
+
@dependency_name = dependency_name
|
|
747
|
+
super(message)
|
|
748
|
+
end
|
|
749
|
+
end
|
|
750
|
+
|
|
723
751
|
class BadRequirementError < Gem::Requirement::BadRequirementError; end
|
|
724
752
|
|
|
725
753
|
#######################
|
|
@@ -39,15 +39,18 @@ module Dependabot
|
|
|
39
39
|
# rubocop:disable-next Performance/DeletePrefix
|
|
40
40
|
relative_dir = Pathname.new(base_directory).sub(%r{\A/}, "").join(T.must(target_directory))
|
|
41
41
|
|
|
42
|
+
# Pass the path as a single argument and use NUL-separated output so
|
|
43
|
+
# paths containing whitespace are preserved. Keep stderr separate so
|
|
44
|
+
# warnings (e.g. a missing target directory) aren't parsed as entries
|
|
42
45
|
status = T.let(
|
|
43
46
|
SharedHelpers.run_shell_command(
|
|
44
|
-
"git status --untracked-files
|
|
45
|
-
fingerprint: "git status --untracked-files
|
|
47
|
+
["git", "status", "--untracked-files=all", "--porcelain=v1", "-z", "--", relative_dir.to_s],
|
|
48
|
+
fingerprint: "git status --untracked-files=all --porcelain=v1 -z -- <relative_dir>",
|
|
49
|
+
stderr_to_stdout: false
|
|
46
50
|
),
|
|
47
51
|
String
|
|
48
52
|
)
|
|
49
|
-
|
|
50
|
-
changed_paths.filter_map do |type, path|
|
|
53
|
+
parse_status(status).filter_map do |type, path|
|
|
51
54
|
project_root = Pathname.new(File.expand_path(File.join(Dir.pwd, base_directory)))
|
|
52
55
|
file_path = Pathname.new(path).expand_path.relative_path_from(project_root)
|
|
53
56
|
|
|
@@ -62,7 +65,7 @@ module Dependabot
|
|
|
62
65
|
operation = Dependabot::DependencyFile::Operation::DELETE if type == "D"
|
|
63
66
|
operation = Dependabot::DependencyFile::Operation::CREATE if type == "??"
|
|
64
67
|
|
|
65
|
-
encoded_content, encoding = get_encoded_file_contents(
|
|
68
|
+
encoded_content, encoding = get_encoded_file_contents(path, operation)
|
|
66
69
|
|
|
67
70
|
create_dependency_file(
|
|
68
71
|
name: file_path.to_s,
|
|
@@ -82,6 +85,26 @@ module Dependabot
|
|
|
82
85
|
sig { returns(T.nilable(String)) }
|
|
83
86
|
attr_reader :repo_contents_path
|
|
84
87
|
|
|
88
|
+
# Parses `git status --porcelain=v1 -z` output into [type, path] pairs.
|
|
89
|
+
# Each entry is "XY <path>"; renames and copies are followed by an extra
|
|
90
|
+
# entry holding the original path, which we skip.
|
|
91
|
+
sig { params(status: String).returns(T::Array[[String, String]]) }
|
|
92
|
+
def parse_status(status)
|
|
93
|
+
entries = status.split("\0")
|
|
94
|
+
changes = T.let([], T::Array[[String, String]])
|
|
95
|
+
|
|
96
|
+
until entries.empty?
|
|
97
|
+
entry = T.must(entries.shift)
|
|
98
|
+
next if entry.empty?
|
|
99
|
+
|
|
100
|
+
code = T.must(entry[0, 2])
|
|
101
|
+
changes << [code.strip, T.must(entry[3..])]
|
|
102
|
+
entries.shift if code.match?(/[RC]/)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
changes
|
|
106
|
+
end
|
|
107
|
+
|
|
85
108
|
sig { returns(T.nilable(String)) }
|
|
86
109
|
attr_reader :target_directory
|
|
87
110
|
|
|
@@ -111,8 +134,11 @@ module Dependabot
|
|
|
111
134
|
def binary_file?(path)
|
|
112
135
|
return false unless File.exist?(path)
|
|
113
136
|
|
|
114
|
-
|
|
115
|
-
|
|
137
|
+
encoding = SharedHelpers.run_shell_command(
|
|
138
|
+
["file", "-b", "--mime-encoding", "--", path],
|
|
139
|
+
fingerprint: "file -b --mime-encoding -- <path>",
|
|
140
|
+
stderr_to_stdout: false
|
|
141
|
+
).strip
|
|
116
142
|
|
|
117
143
|
!TEXT_ENCODINGS.include?(encoding)
|
|
118
144
|
end
|
data/lib/dependabot.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dependabot-common
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.403.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dependabot
|
|
@@ -635,7 +635,7 @@ licenses:
|
|
|
635
635
|
- MIT
|
|
636
636
|
metadata:
|
|
637
637
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
|
638
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
|
638
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.403.0
|
|
639
639
|
rdoc_options: []
|
|
640
640
|
require_paths:
|
|
641
641
|
- lib
|