Class: Dependabot::GoModules::UpdateChecker::LatestVersionFinder

Inherits:
Package::PackageLatestVersionFinder
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/go_modules/update_checker/latest_version_finder.rb

Constant Summary collapse

RESOLVABILITY_ERROR_REGEXES =
T.let(
  [
    # Package url/proxy doesn't include any redirect meta tags
    /no go-import meta tags/,
    # Package url 404s
    /404 Not Found/,
    /Repository not found/,
    /unrecognized import path/,
    /malformed module path/,
    # (Private) module could not be fetched
    /module .*: git ls-remote .*: exit status 128/m
  ].freeze,
  T::Array[Regexp]
)
INVALID_VERSION_REGEX =

The module was retracted from the proxy OR the version of Go required is greater than what Dependabot supports OR other go.mod version errors

/(go: loading module retractions for)|(version "[^"]+" invalid)/m
PSEUDO_VERSION_REGEX =
/\b\d{14}-[0-9a-f]{12}$/

Instance Method Summary collapse

Constructor Details

#initialize(dependency:, dependency_files:, credentials:, ignored_versions:, security_advisories:, raise_on_ignored: false, cooldown_options: nil) ⇒ LatestVersionFinder

Returns a new instance of LatestVersionFinder.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/dependabot/go_modules/update_checker/latest_version_finder.rb', line 56

def initialize(
  dependency:,
  dependency_files:,
  credentials:,
  ignored_versions:,
  security_advisories:,
  raise_on_ignored: false,
  cooldown_options: nil
)
  @dependency          = dependency
  @dependency_files    = dependency_files
  @credentials         = credentials
  @ignored_versions    = ignored_versions
  @security_advisories = security_advisories
  @raise_on_ignored    = raise_on_ignored
  @cooldown_options    = cooldown_options
  super(
    dependency: dependency,
    dependency_files: dependency_files,
    credentials: credentials,
    ignored_versions: ignored_versions,
    security_advisories: security_advisories,
    cooldown_options: cooldown_options,
    raise_on_ignored: raise_on_ignored,
    options: {}
  )
end

Instance Method Details

#cooldown_enabled?Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/dependabot/go_modules/update_checker/latest_version_finder.rb', line 107

def cooldown_enabled?
  true
end

#latest_version(language_version: nil) ⇒ Object



88
89
90
91
92
93
# File 'lib/dependabot/go_modules/update_checker/latest_version_finder.rb', line 88

def latest_version(language_version: nil)
  @latest_version ||= T.let(
    fetch_latest_version(language_version: language_version),
    T.nilable(Dependabot::Version)
  )
end

#lowest_security_fix_version(language_version: nil) ⇒ Object



99
100
101
102
103
104
# File 'lib/dependabot/go_modules/update_checker/latest_version_finder.rb', line 99

def lowest_security_fix_version(language_version: nil)
  @lowest_security_fix_version ||= T.let(
    fetch_lowest_security_fix_version(language_version: language_version),
    T.nilable(Dependabot::Version)
  )
end