diff --git a/abi3audit/_cli.py b/abi3audit/_cli.py index e261359..d8c7e07 100644 --- a/abi3audit/_cli.py +++ b/abi3audit/_cli.py @@ -126,7 +126,7 @@ def json(self) -> dict[str, Any]: # TODO(ww): These inner helpers could definitely be consolidated. def _one_object(results: list[AuditResult]) -> dict[str, Any]: # NOTE: Anything else indicates a logic error. - assert len(results) == 1 + assert len(results) == 1 # noqa: S101 return {"name": results[0].so.path.name, "result": results[0].json()} def _one_wheel(results: list[AuditResult]) -> list[dict[str, Any]]: @@ -228,12 +228,12 @@ def main() -> None: logging.root.setLevel("DEBUG") specs = [] - for spec in args.specs: - try: + try: + for spec in args.specs: specs.extend(make_specs(spec, assume_minimum_abi3=args.assume_minimum_abi3)) - except InvalidSpec as e: - console.log(f"[red]:thumbs_down: processing error: {e}") - sys.exit(1) + except InvalidSpec as e: + console.log(f"[red]:thumbs_down: processing error: {e}") + sys.exit(1) logger.debug(f"parsed arguments: {args}") diff --git a/abi3audit/_extract.py b/abi3audit/_extract.py index e14b5e9..5a57add 100644 --- a/abi3audit/_extract.py +++ b/abi3audit/_extract.py @@ -40,8 +40,6 @@ class InvalidSpec(ValueError): specification into something that can be extracted. """ - pass - class WheelSpec(str): """ @@ -50,6 +48,8 @@ class WheelSpec(str): A wheel can contain multiple Python extensions, as shared objects. """ + __slots__ = () + def _extractor(self) -> Extractor: """ Returns an extractor for this wheel's shared objects. @@ -64,6 +64,8 @@ class SharedObjectSpec(str): A shared object may or may not be a Python extension. """ + __slots__ = () + def _extractor(self) -> Extractor: """ Returns a "trivial" extractor for this shared object. @@ -79,6 +81,8 @@ class PyPISpec(str): may be tagged as abi3 compatible. """ + __slots__ = () + def _extractor(self) -> Extractor: """ Returns an extractor for each shared object in each published abi3 wheel. @@ -125,8 +129,6 @@ class ExtractorError(ValueError): from the requested source. """ - pass - class WheelExtractor: """ diff --git a/abi3audit/_object.py b/abi3audit/_object.py index 9566612..33c2887 100644 --- a/abi3audit/_object.py +++ b/abi3audit/_object.py @@ -59,8 +59,7 @@ def abi3_version(self, assume_lowest: PyVersion) -> PyVersion | None: ) return assume_lowest - # With no wheel tags and no filename tag, fall back on the assumed ABI - # version (which is possibly None). + # With no wheel tags and no filename tag, fall back on the assumed ABI version. return assume_lowest def __str__(self) -> str: diff --git a/pyproject.toml b/pyproject.toml index 5396794..f76da33 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ Source = "https://github.com/pypa/abi3audit" [project.optional-dependencies] test = ["pytest", "pytest-cov", "pretend", "coverage[toml]"] -lint = ["bandit", "interrogate", "mypy", "ruff", "types-requests"] +lint = ["interrogate", "mypy", "ruff", "types-requests"] dev = ["build", "pdoc3", "abi3audit[test,lint]"] [project.scripts] @@ -64,14 +64,19 @@ warn_unreachable = true warn_unused_configs = true warn_unused_ignores = true -[tool.bandit] -exclude_dirs = ["./test"] - [tool.coverage.run] omit = ["abi3audit/_vendor/*"] [tool.ruff] line-length = 100 +exclude = ["abi3audit/_vendor"] [tool.ruff.lint] -select = ["E", "F", "I", "W", "UP"] +select = ["E", "F", "I", "W", "S", "B", "A", "C4", "EXE", "FA", "ISC", "ICN", "LOG", "PIE", "PYI", "SLOT", "FLY", "PERF", "PGH", "PL", "FURB", "UP"] +ignore = ["PLR1730", "PLR2004"] + +[tool.ruff.lint.flake8-bugbear] +extend-immutable-calls = ["abi3info.models.PyVersion"] + +[tool.ruff.lint.per-file-ignores] +"test/**.py" = ["S101", "S113"] diff --git a/uv.lock b/uv.lock index 37438e5..7dbdf89 100644 --- a/uv.lock +++ b/uv.lock @@ -22,7 +22,6 @@ dependencies = [ [package.optional-dependencies] dev = [ - { name = "bandit" }, { name = "build" }, { name = "coverage", extra = ["toml"] }, { name = "interrogate" }, @@ -35,7 +34,6 @@ dev = [ { name = "types-requests" }, ] lint = [ - { name = "bandit" }, { name = "interrogate" }, { name = "mypy" }, { name = "ruff" }, @@ -52,7 +50,6 @@ test = [ requires-dist = [ { name = "abi3audit", extras = ["test", "lint"], marker = "extra == 'dev'" }, { name = "abi3info", specifier = ">=2024.6.19" }, - { name = "bandit", marker = "extra == 'lint'" }, { name = "build", marker = "extra == 'dev'" }, { name = "coverage", extras = ["toml"], marker = "extra == 'test'" }, { name = "interrogate", marker = "extra == 'lint'" }, @@ -91,21 +88,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/77/06/bb80f5f86020c4551da315d78b3ab75e8228f89f0162f2c3a819e407941a/attrs-25.3.0-py3-none-any.whl", hash = "sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3", size = 63815, upload-time = "2025-03-13T11:10:21.14Z" }, ] -[[package]] -name = "bandit" -version = "1.8.6" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "colorama", marker = "sys_platform == 'win32'" }, - { name = "pyyaml" }, - { name = "rich" }, - { name = "stevedore" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/fb/b5/7eb834e213d6f73aace21938e5e90425c92e5f42abafaf8a6d5d21beed51/bandit-1.8.6.tar.gz", hash = "sha256:dbfe9c25fc6961c2078593de55fd19f2559f9e45b99f1272341f5b95dea4e56b", size = 4240271, upload-time = "2025-07-06T03:10:50.9Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/48/ca/ba5f909b40ea12ec542d5d7bdd13ee31c4d65f3beed20211ef81c18fa1f3/bandit-1.8.6-py3-none-any.whl", hash = "sha256:3348e934d736fcdb68b6aa4030487097e23a501adf3e7827b63658df464dddd0", size = 133808, upload-time = "2025-07-06T03:10:49.134Z" }, -] - [[package]] name = "build" version = "1.3.0"