From aebf8791630f5c3c716d8483585b22697f001f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Tr=C3=B6ger?= Date: Wed, 2 Oct 2024 17:13:44 +1000 Subject: [PATCH] chore: fix pylint message overlapping-except (#886) Signed-off-by: Jens Troeger --- pyproject.toml | 1 + src/macaron/config/defaults.py | 2 +- src/macaron/dependency_analyzer/cyclonedx.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5677e24c8..f433a7c7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -213,6 +213,7 @@ fail-under = 10.0 suggestion-mode = true # Remove this setting when pylint v4 is released. load-plugins = [ "pylint.extensions.for_any_all", + "pylint.extensions.overlapping_exceptions", "pylint.extensions.set_membership", ] disable = [ diff --git a/src/macaron/config/defaults.py b/src/macaron/config/defaults.py index 2469d7a31..0ac469604 100644 --- a/src/macaron/config/defaults.py +++ b/src/macaron/config/defaults.py @@ -170,6 +170,6 @@ def create_defaults(output_path: str, cwd_path: str) -> bool: ) return True # We catch OSError to support errors on different platforms. - except (OSError, shutil.Error) as error: + except OSError as error: logger.error("Failed to create %s: %s.", os.path.relpath(dest_path, cwd_path), error) return False diff --git a/src/macaron/dependency_analyzer/cyclonedx.py b/src/macaron/dependency_analyzer/cyclonedx.py index 80deddf14..d1bd93eac 100644 --- a/src/macaron/dependency_analyzer/cyclonedx.py +++ b/src/macaron/dependency_analyzer/cyclonedx.py @@ -86,7 +86,7 @@ def deserialize_bom_json(file_path: Path) -> Bom: # This method is injected into the Bom class that is annotated by ``serializable`` but mypy is not # able to detect that. bom_from_json = Bom.from_json(json.loads(json_data)) # type: ignore[attr-defined] - except (ValueError, AttributeError, json.JSONDecodeError) as error: + except (ValueError, AttributeError) as error: raise CycloneDXParserError(f"Could not process the dependencies at {file_path}: {error}") from None if isinstance(bom_from_json, Bom):