Class: Dependabot::Config::IgnoreCondition

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/config/ignore_condition.rb

Overview

Filters versions that should not be considered for dependency updates

Constant Summary collapse

PATCH_VERSION_TYPE =
"version-update:semver-patch"
MINOR_VERSION_TYPE =
"version-update:semver-minor"
MAJOR_VERSION_TYPE =
"version-update:semver-major"
ALL_VERSIONS =
">= 0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dependency_name:, versions: nil, update_types: nil) ⇒ IgnoreCondition

Returns a new instance of IgnoreCondition.



34
35
36
37
38
# File 'lib/dependabot/config/ignore_condition.rb', line 34

def initialize(dependency_name:, versions: nil, update_types: nil)
  @dependency_name = T.let(dependency_name, String)
  @versions = T.let(versions || [], T::Array[String])
  @update_types = T.let(update_types || [], T::Array[String])
end

Instance Attribute Details

#dependency_nameObject (readonly)

Returns the value of attribute dependency_name.



19
20
21
# File 'lib/dependabot/config/ignore_condition.rb', line 19

def dependency_name
  @dependency_name
end

#update_typesObject (readonly)

Returns the value of attribute update_types.



25
26
27
# File 'lib/dependabot/config/ignore_condition.rb', line 25

def update_types
  @update_types
end

#versionsObject (readonly)

Returns the value of attribute versions.



22
23
24
# File 'lib/dependabot/config/ignore_condition.rb', line 22

def versions
  @versions
end

Instance Method Details

#ignored_versions(dependency, security_updates_only) ⇒ Object



41
42
43
44
45
46
# File 'lib/dependabot/config/ignore_condition.rb', line 41

def ignored_versions(dependency, security_updates_only)
  return versions if security_updates_only
  return [ALL_VERSIONS] if versions.empty? && transformed_update_types.empty?

  versions_by_type(dependency) + versions
end