Class: Dependabot::Uv::DependencyGrapher
- Inherits:
-
DependencyGraphers::Base
- Object
- DependencyGraphers::Base
- Dependabot::Uv::DependencyGrapher
- Defined in:
- lib/dependabot/uv/dependency_grapher.rb
Constant Summary collapse
- RUNTIME_GROUP =
T.let("dependencies", String)
- DEV_GROUP =
T.let("dev-dependencies", String)
Instance Method Summary collapse
Instance Method Details
#prepare! ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/dependabot/uv/dependency_grapher.rb', line 29 def prepare! raise DependabotError, "No uv.lock present; uv graphing requires a lockfile." unless uv_lock parsed = TomlRB.parse(T.must(T.must(uv_lock).content)) packages = T.cast(parsed.fetch("package", []), T::Array[T.untyped]) manifest = parsed.fetch("manifest", {}) root_names = root_package_names(packages, manifest) direct_runtime, direct_dev = direct_dependency_names(packages, root_names) @dependencies = packages.filter_map do |pkg| build_dependency(pkg, root_names, direct_runtime, direct_dev) end @prepared = true rescue DependabotError raise rescue StandardError => e # If uv.lock is unparseable we can't build a graph at all, but we still # want the rest of the submission flow to continue (matching the prior # behaviour where lockfile parse failures only marked subdependency # fetching as errored). errored_fetching_subdependencies! @subdependency_error = e Dependabot.logger.error("Failed to parse uv.lock for graphing: #{e.}") @dependencies = [] @prepared = true end |
#relevant_dependency_file ⇒ Object
19 20 21 |
# File 'lib/dependabot/uv/dependency_grapher.rb', line 19 def relevant_dependency_file uv_lock || raise(DependabotError, "No uv.lock present; uv graphing requires a lockfile.") end |