Class: Dependabot::Python::PoetryErrorHandler

Inherits:
UpdateChecker
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/python/update_checker/poetry_version_resolver.rb

Constant Summary collapse

INVALID_CONFIGURATION =

if a valid config value is not found in project.toml file

/The Poetry configuration is invalid:(?<config>.*)/
INVALID_VERSION =

if .toml has incorrect version specification i.e. <0.2.0app

/Could not parse version constraint: (?<ver>.*)/
/No valid distribution links found for package: "(?<dep>.*)" version: "(?<ver>.*)"/

Constants inherited from UpdateChecker

UpdateChecker::MAIN_PYPI_INDEXES, UpdateChecker::VERSION_REGEX

Instance Method Summary collapse

Methods inherited from UpdateChecker

#latest_resolvable_version, #latest_resolvable_version_with_no_unlock, #latest_version, #lowest_resolvable_security_fix_version, #lowest_security_fix_version, #requirements_unlocked_or_can_be?, #requirements_update_strategy, #updated_requirements

Constructor Details

#initialize(dependencies:, dependency_files:) ⇒ PoetryErrorHandler

Returns a new instance of PoetryErrorHandler.



356
357
358
359
# File 'lib/dependabot/python/update_checker/poetry_version_resolver.rb', line 356

def initialize(dependencies:, dependency_files:)
  @dependencies = dependencies
  @dependency_files = dependency_files
end

Instance Method Details

#handle_poetry_error(error) ⇒ Object



372
373
374
375
376
377
378
379
380
381
# File 'lib/dependabot/python/update_checker/poetry_version_resolver.rb', line 372

def handle_poetry_error(error)
  Dependabot.logger.warn(error.message)

  if (msg = error.message.match(PoetryVersionResolver::INCOMPATIBLE_CONSTRAINTS) ||
      error.message.match(INVALID_CONFIGURATION) || error.message.match(INVALID_VERSION) ||
      error.message.match(INVALID_LINK))

    raise DependencyFileNotResolvable, msg
  end
end