Class: Dependabot::Nuget::UpdateChecker
- Inherits:
-
UpdateCheckers::Base
- Object
- UpdateCheckers::Base
- Dependabot::Nuget::UpdateChecker
show all
- Extended by:
- T::Sig
- 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/dependency_finder.rb,
lib/dependabot/nuget/update_checker/requirements_updater.rb
Defined Under Namespace
Classes: DependencyFinder, PropertyUpdater, RequirementsUpdater, VersionFinder
Constant Summary
collapse
- PROPERTY_REGEX =
/\$\((?<property>.*?)\)/
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.native_analysis_enabled? ⇒ Boolean
24
25
26
|
# File 'lib/dependabot/nuget/update_checker.rb', line 24
def self.native_analysis_enabled?
Dependabot::Experiments.enabled?(:nuget_native_analysis)
end
|
Instance Method Details
#latest_resolvable_version ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/dependabot/nuget/update_checker.rb', line 43
def latest_resolvable_version
return native_update_checker.latest_resolvable_version if UpdateChecker.native_analysis_enabled?
nil
end
|
#latest_resolvable_version_with_no_unlock ⇒ Object
66
67
68
69
70
71
|
# File 'lib/dependabot/nuget/update_checker.rb', line 66
def latest_resolvable_version_with_no_unlock
return native_update_checker.latest_resolvable_version_with_no_unlock if UpdateChecker.native_analysis_enabled?
nil
end
|
#latest_version ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/dependabot/nuget/update_checker.rb', line 29
def latest_version
return native_update_checker.latest_version if UpdateChecker.native_analysis_enabled?
return dependency.version if !dependency.top_level? && !vulnerable?
@latest_version = T.let(
latest_version_details&.fetch(:version)&.to_s || dependency.version,
T.nilable(String)
)
end
|
#lowest_resolvable_security_fix_version ⇒ Object
59
60
61
62
63
|
# File 'lib/dependabot/nuget/update_checker.rb', line 59
def lowest_resolvable_security_fix_version
return nil if version_comes_from_multi_dependency_property?
lowest_security_fix_version
end
|
#lowest_security_fix_version ⇒ Object
52
53
54
55
56
|
# File 'lib/dependabot/nuget/update_checker.rb', line 52
def lowest_security_fix_version
return native_update_checker.lowest_security_fix_version if UpdateChecker.native_analysis_enabled?
lowest_security_fix_version_details&.fetch(:version)
end
|
#requirements_unlocked_or_can_be? ⇒ Boolean
100
101
102
103
104
105
106
107
|
# File 'lib/dependabot/nuget/update_checker.rb', line 100
def requirements_unlocked_or_can_be?
dependency.requirements.none? do |req|
req.fetch(:requirement)&.match?(PROPERTY_REGEX)
end
end
|
#up_to_date? ⇒ Boolean
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/dependabot/nuget/update_checker.rb', line 85
def up_to_date?
return native_update_checker.up_to_date? if UpdateChecker.native_analysis_enabled?
return true if !dependency.top_level? && !vulnerable?
return true unless requirements_unlocked_or_can_be?
super
end
|
#updated_requirements ⇒ Object
74
75
76
77
78
79
80
81
82
|
# File 'lib/dependabot/nuget/update_checker.rb', line 74
def updated_requirements
return native_update_checker.updated_requirements if UpdateChecker.native_analysis_enabled?
RequirementsUpdater.new(
requirements: dependency.requirements,
latest_version: preferred_resolvable_version_details&.fetch(:version, nil)&.to_s,
source_details: preferred_resolvable_version_details&.slice(:nuspec_url, :repo_url, :source_url)
).updated_requirements
end
|