Class: Dependabot::PreCommit::AdditionalDependencyCheckers::Base

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/dependabot/pre_commit/additional_dependency_checkers/base.rb

Overview

Abstract base class for language-specific additional_dependency update checkers. Each language implementation should inherit from this class and implement the abstract methods.

The checker is responsible for:

  1. Finding the latest available version from the language’s registry (PyPI, npm, etc.)

  2. Generating updated requirements that preserve the original version constraint operators

Example implementation for a new language:

class MyLanguage < Base
  def latest_version
    # Delegate to ecosystem's UpdateChecker
    ecosystem_checker = Dependabot::UpdateCheckers
      .for_package_manager("my_pm")
      .new(dependency: build_ecosystem_dependency, ...)
    ecosystem_checker.latest_version&.to_s
  end

  def updated_requirements(latest_version)
    # Build updated requirements preserving operators
  end
end

AdditionalDependencyCheckers.register("my_language", MyLanguage)

Direct Known Subclasses

Dart, Go, Node, Python, Ruby, Rust

Instance Method Summary collapse

Constructor Details

#initialize(source:, credentials:, requirements:, current_version:) ⇒ Base

Returns a new instance of Base.



49
50
51
52
53
54
# File 'lib/dependabot/pre_commit/additional_dependency_checkers/base.rb', line 49

def initialize(source:, credentials:, requirements:, current_version:)
  @source = source
  @credentials = credentials
  @requirements = requirements
  @current_version = current_version
end

Instance Method Details

#latest_versionObject



60
# File 'lib/dependabot/pre_commit/additional_dependency_checkers/base.rb', line 60

def latest_version; end

#updated_requirements(latest_version) ⇒ Object



66
# File 'lib/dependabot/pre_commit/additional_dependency_checkers/base.rb', line 66

def updated_requirements(latest_version); end