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.



54
55
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
# File 'lib/dependabot/go_modules/update_checker/latest_version_finder.rb', line 54

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)


105
106
107
# File 'lib/dependabot/go_modules/update_checker/latest_version_finder.rb', line 105

def cooldown_enabled?
  true
end

#latest_version(language_version: nil) ⇒ Object



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

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



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

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