From 61eee4c3e10b2c6d54058642a83aa3aadae1f972 Mon Sep 17 00:00:00 2001 From: "Y.D.X" <73375426+YDX-2147483647@users.noreply.github.com> Date: Fri, 16 Jun 2023 13:22:12 +0800 Subject: [PATCH] refactor: Remove unused `warnings = []` --- src/poetry/console/commands/check.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/poetry/console/commands/check.py b/src/poetry/console/commands/check.py index d2bc141ee90..30d48d80856 100644 --- a/src/poetry/console/commands/check.py +++ b/src/poetry/console/commands/check.py @@ -29,7 +29,7 @@ class CheckCommand(Command): ), ] - def validate_classifiers( + def _validate_classifiers( self, project_classifiers: set[str] ) -> tuple[list[str], list[str]]: """Identify unrecognized and deprecated trove classifiers. @@ -79,21 +79,18 @@ def validate_classifiers( return errors, warnings - def validate_readme( + def _validate_readme( self, readme: str | list[str], poetry_file: Path - ) -> tuple[list[str], list[str]]: + ) -> list[str]: """Check existence of referenced readme files""" - errors = [] - warnings: list[str] = [] - readmes = [readme] if isinstance(readme, str) else readme + errors = [] for name in readmes: if not (poetry_file.parent / name).exists(): errors.append(f"Declared README file does not exist: {name}") - - return errors, warnings + return errors def handle(self) -> int: from poetry.factory import Factory @@ -106,15 +103,14 @@ def handle(self) -> int: # Validate trove classifiers project_classifiers = set(config.get("classifiers", [])) - errors, warnings = self.validate_classifiers(project_classifiers) + errors, warnings = self._validate_classifiers(project_classifiers) check_result["errors"].extend(errors) check_result["warnings"].extend(warnings) # Validate readme (files must exist) if "readme" in config: - errors, warnings = self.validate_readme(config["readme"], poetry_file) + errors = self._validate_readme(config["readme"], poetry_file) check_result["errors"].extend(errors) - check_result["warnings"].extend(warnings) # Verify that lock file is consistent if self.option("lock") and not self.poetry.locker.is_locked():