Class: Dependabot::Nuget::UpdateChecker

Inherits:
UpdateCheckers::Base
  • Object
show all
Defined in:
lib/dependabot/nuget/update_checker.rb,
lib/dependabot/nuget/update_checker/version_finder.rb,
lib/dependabot/nuget/update_checker/property_updater.rb,
lib/dependabot/nuget/update_checker/repository_finder.rb,
lib/dependabot/nuget/update_checker/requirements_updater.rb

Defined Under Namespace

Classes: PropertyUpdater, RepositoryFinder, RequirementsUpdater, VersionFinder

Instance Method Summary collapse

Instance Method Details

#latest_resolvable_versionObject



18
19
20
21
22
23
# File 'lib/dependabot/nuget/update_checker.rb', line 18

def latest_resolvable_version
  # TODO: Check version resolution!
  return nil if version_comes_from_multi_dependency_property?

  latest_version
end

#latest_resolvable_version_with_no_unlockObject



35
36
37
38
# File 'lib/dependabot/nuget/update_checker.rb', line 35

def latest_resolvable_version_with_no_unlock
  # Irrelevant, since Nuget has a single dependency file
  nil
end

#latest_versionObject



14
15
16
# File 'lib/dependabot/nuget/update_checker.rb', line 14

def latest_version
  @latest_version = latest_version_details&.fetch(:version)
end

#lowest_resolvable_security_fix_versionObject



29
30
31
32
33
# File 'lib/dependabot/nuget/update_checker.rb', line 29

def lowest_resolvable_security_fix_version
  return nil if version_comes_from_multi_dependency_property?

  lowest_security_fix_version
end

#lowest_security_fix_versionObject



25
26
27
# File 'lib/dependabot/nuget/update_checker.rb', line 25

def lowest_security_fix_version
  lowest_security_fix_version_details&.fetch(:version)
end

#requirements_unlocked_or_can_be?Boolean

Returns:

  • (Boolean)


58
59
60
61
62
63
64
65
66
# File 'lib/dependabot/nuget/update_checker.rb', line 58

def requirements_unlocked_or_can_be?
  # If any requirements have an uninterpolated property in them then
  # that property couldn't be found, and the requirement therefore
  # cannot be unlocked (since we can't update that property)
  namespace = Nuget::FileParser::PropertyValueFinder
  dependency.requirements.none? do |req|
    req.fetch(:requirement)&.match?(namespace::PROPERTY_REGEX)
  end
end

#up_to_date?Boolean

Returns:

  • (Boolean)


49
50
51
52
53
54
55
56
# File 'lib/dependabot/nuget/update_checker.rb', line 49

def up_to_date?
  # If any requirements have an uninterpolated property in them then
  # that property couldn't be found, and we assume that the dependency
  # is up-to-date
  return true unless requirements_unlocked_or_can_be?

  super
end

#updated_requirementsObject



40
41
42
43
44
45
46
47
# File 'lib/dependabot/nuget/update_checker.rb', line 40

def updated_requirements
  RequirementsUpdater.new(
    requirements: dependency.requirements,
    latest_version: preferred_resolvable_version&.to_s,
    source_details: preferred_version_details&.
                    slice(:nuspec_url, :repo_url, :source_url)
  ).updated_requirements
end