Class: Dependabot::Config::IgnoreCondition

Inherits:
Object
  • Object
show all
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.



15
16
17
18
19
# File 'lib/dependabot/config/ignore_condition.rb', line 15

def initialize(dependency_name:, versions: nil, update_types: nil)
  @dependency_name = dependency_name
  @versions = versions || []
  @update_types = update_types || []
end

Instance Attribute Details

#dependency_nameObject (readonly)

Returns the value of attribute dependency_name.



13
14
15
# File 'lib/dependabot/config/ignore_condition.rb', line 13

def dependency_name
  @dependency_name
end

#update_typesObject (readonly)

Returns the value of attribute update_types.



13
14
15
# File 'lib/dependabot/config/ignore_condition.rb', line 13

def update_types
  @update_types
end

#versionsObject (readonly)

Returns the value of attribute versions.



13
14
15
# File 'lib/dependabot/config/ignore_condition.rb', line 13

def versions
  @versions
end

Instance Method Details

#ignored_versions(dependency, security_updates_only) ⇒ Object



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

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