Class: SilentPackageManager::UpdateChecker

Inherits:
Dependabot::UpdateCheckers::Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/silent/update_checker.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args, **kwargs) ⇒ UpdateChecker

Returns a new instance of UpdateChecker.



16
17
18
19
# File 'lib/dependabot/silent/update_checker.rb', line 16

def initialize(*args, **kwargs)
  super
  @available_versions = T.let(nil, T.nilable(T::Array[SilentPackageManager::Version]))
end

Instance Method Details

#latest_resolvable_versionObject



62
63
64
# File 'lib/dependabot/silent/update_checker.rb', line 62

def latest_resolvable_version
  latest_version
end

#latest_versionObject



22
23
24
25
26
27
28
# File 'lib/dependabot/silent/update_checker.rb', line 22

def latest_version
  return next_git_version if git_dependency?

  versions = available_versions
  versions = filter_ignored_versions(versions)
  versions.max.to_s
end

#latest_version_resolvable_with_full_unlock?Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
# File 'lib/dependabot/silent/update_checker.rb', line 31

def latest_version_resolvable_with_full_unlock?
  # For ecosystems that have lockfiles, the updater allows an ecosystem to try progressively
  # more aggressive approaches to dependency unlocking. This method represents the most aggressive
  # approach that allows for updating all dependencies to try to get the target dependency to update.
  # We're going to let the specs handle testing that logic, returning false here.
  false
end

#lowest_resolvable_security_fix_versionObject



50
51
52
53
54
# File 'lib/dependabot/silent/update_checker.rb', line 50

def lowest_resolvable_security_fix_version
  raise "Dependency not vulnerable!" unless vulnerable?

  lowest_security_fix_version
end

#lowest_security_fix_versionObject



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

def lowest_security_fix_version
  versions = available_versions
  versions = filter_lower_versions(versions)
  Dependabot::UpdateCheckers::VersionFilters.filter_vulnerable_versions(
    versions,
    security_advisories
  ).min
end

#up_to_date?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/dependabot/silent/update_checker.rb', line 57

def up_to_date?
  dependency.version == latest_version
end

#updated_requirementsObject



67
68
69
70
71
# File 'lib/dependabot/silent/update_checker.rb', line 67

def updated_requirements
  dependency.requirements.map do |req|
    req.merge(requirement: preferred_resolvable_version)
  end
end