Class: Dependabot::Cargo::FileParser

Inherits:
FileParsers::Base
  • Object
show all
Defined in:
lib/dependabot/cargo/file_parser.rb

Constant Summary collapse

DEPENDENCY_TYPES =
%w(dependencies dev-dependencies build-dependencies).freeze

Instance Method Summary collapse

Instance Method Details

#parseObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/dependabot/cargo/file_parser.rb', line 26

def parse
  check_rust_workspace_root

  dependency_set = DependencySet.new
  dependency_set += manifest_dependencies
  dependency_set += lockfile_dependencies if lockfile

  dependencies = dependency_set.dependencies

  # TODO: Handle patched dependencies
  dependencies.reject! { |d| patched_dependencies.include?(d.name) }

  # TODO: Currently, Dependabot can't handle dependencies that have
  # multiple sources. Fix that!
  dependencies.reject do |dep|
    dep.requirements.map { |r| r.fetch(:source) }.uniq.count > 1
  end
end