Class: Dependabot::Nuget::NativeUpdateChecker

Inherits:
UpdateCheckers::Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/nuget/native_update_checker/native_update_checker.rb,
lib/dependabot/nuget/native_update_checker/native_requirements_updater.rb

Defined Under Namespace

Classes: NativeRequirementsUpdater

Instance Method Summary collapse

Instance Method Details

#latest_resolvable_versionObject



30
31
32
33
34
# File 'lib/dependabot/nuget/native_update_checker/native_update_checker.rb', line 30

def latest_resolvable_version
  # We always want a full unlock since any package update could update peer dependencies as well.
  # To force a full unlock instead of an own unlock, we return nil.
  nil
end

#latest_resolvable_version_with_no_unlockObject



49
50
51
52
# File 'lib/dependabot/nuget/native_update_checker/native_update_checker.rb', line 49

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

#latest_versionObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/dependabot/nuget/native_update_checker/native_update_checker.rb', line 18

def latest_version
  # No need to find latest version for transitive dependencies unless they have a vulnerability.
  return dependency.version if !dependency.top_level? && !vulnerable?

  # if no update sources have the requisite package, then we can only assume that the current version is correct
  @latest_version = T.let(
    update_analysis.dependency_analysis.updated_version,
    T.nilable(String)
  )
end

#lowest_resolvable_security_fix_versionObject



42
43
44
45
46
# File 'lib/dependabot/nuget/native_update_checker/native_update_checker.rb', line 42

def lowest_resolvable_security_fix_version
  return nil if version_comes_from_multi_dependency_property?

  update_analysis.dependency_analysis.numeric_updated_version
end

#lowest_security_fix_versionObject



37
38
39
# File 'lib/dependabot/nuget/native_update_checker/native_update_checker.rb', line 37

def lowest_security_fix_version
  update_analysis.dependency_analysis.numeric_updated_version
end

#public_latest_version_resolvable_with_full_unlock?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/dependabot/nuget/native_update_checker/native_update_checker.rb', line 74

def public_latest_version_resolvable_with_full_unlock?
  latest_version_resolvable_with_full_unlock?
end

#public_updated_dependencies_after_full_unlockObject



79
80
81
# File 'lib/dependabot/nuget/native_update_checker/native_update_checker.rb', line 79

def public_updated_dependencies_after_full_unlock
  updated_dependencies_after_full_unlock
end

#requirements_unlocked_or_can_be?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/dependabot/nuget/native_update_checker/native_update_checker.rb', line 69

def requirements_unlocked_or_can_be?
  update_analysis.dependency_analysis.can_update
end

#up_to_date?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/dependabot/nuget/native_update_checker/native_update_checker.rb', line 64

def up_to_date?
  !update_analysis.dependency_analysis.can_update
end

#updated_requirementsObject



55
56
57
58
59
60
61
# File 'lib/dependabot/nuget/native_update_checker/native_update_checker.rb', line 55

def updated_requirements
  dep_details = updated_dependency_details.find { |d| d.name.casecmp?(dependency.name) }
  NativeRequirementsUpdater.new(
    requirements: dependency.requirements,
    dependency_details: dep_details
  ).updated_requirements
end