From f2bd6a9fc27ddfc76ece8d603f93f4f25c31717a Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Fri, 27 Oct 2023 17:13:08 +0200 Subject: [PATCH] Fix linting (#77) * remove black, fix lint Signed-off-by: William Woodruff * drop isort Signed-off-by: William Woodruff * drop old setting Signed-off-by: William Woodruff --------- Signed-off-by: William Woodruff --- .github/workflows/release.yml | 1 - Makefile | 6 ++---- abi3audit/_cli.py | 8 ++++---- pyproject.toml | 37 +++++------------------------------ 4 files changed, 11 insertions(+), 41 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9767310..4916888 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,4 +37,3 @@ jobs: with: inputs: ./dist/*.tar.gz ./dist/*.whl release-signing-artifacts: true - bundle-only: true diff --git a/Makefile b/Makefile index dc78e6a..5eb57f1 100644 --- a/Makefile +++ b/Makefile @@ -50,8 +50,7 @@ $(VENV_EXISTS): pyproject.toml .PHONY: lint lint: $(VENV_EXISTS) . $(VENV_BIN)/activate && \ - black --check $(ALL_PY_SRCS) && \ - isort --check $(ALL_PY_SRCS) && \ + ruff format --check $(ALL_PY_SRCS) && \ ruff $(ALL_PY_SRCS) && \ mypy $(PY_MODULE) # TODO: Enable. @@ -61,8 +60,7 @@ lint: $(VENV_EXISTS) format: $(VENV_EXISTS) . $(VENV_BIN)/activate && \ ruff --fix $(ALL_PY_SRCS) && \ - black $(ALL_PY_SRCS) && \ - isort $(ALL_PY_SRCS) + ruff format $(ALL_PY_SRCS) .PHONY: test tests test tests: $(VENV_EXISTS) diff --git a/abi3audit/_cli.py b/abi3audit/_cli.py index 8ecc60e..8fe7bd0 100644 --- a/abi3audit/_cli.py +++ b/abi3audit/_cli.py @@ -10,7 +10,7 @@ import os import sys from collections import defaultdict -from typing import Any, DefaultDict +from typing import Any from abi3info.models import PyVersion from rich import traceback @@ -87,9 +87,9 @@ def _ensure_pyversion(cls, version: str) -> PyVersion: class SpecResults: def __init__(self) -> None: # Map of extractor -> shared object -> audit result - self._results: DefaultDict[Extractor, list[AuditResult]] = defaultdict(list) - self._bad_abi3_version_counts: DefaultDict[SharedObject, int] = defaultdict(int) - self._abi3_violation_counts: DefaultDict[SharedObject, int] = defaultdict(int) + self._results: defaultdict[Extractor, list[AuditResult]] = defaultdict(list) + self._bad_abi3_version_counts: defaultdict[SharedObject, int] = defaultdict(int) + self._abi3_violation_counts: defaultdict[SharedObject, int] = defaultdict(int) def add(self, extractor: Extractor, so: SharedObject, result: AuditResult) -> None: self._results[extractor].append(result) diff --git a/pyproject.toml b/pyproject.toml index 3156281..70fb2b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,9 +8,7 @@ dynamic = ["version"] description = "Scans Python wheels for abi3 violations and inconsistencies" readme = "README.md" license = { file = "LICENSE" } -authors = [ - { name = "William Woodruff", email = "william@trailofbits.com" } -] +authors = [{ name = "William Woodruff", email = "william@trailofbits.com" }] classifiers = [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3 :: Only", @@ -39,35 +37,13 @@ Issues = "https://github.com/trailofbits/abi3audit/issues" Source = "https://github.com/trailofbits/abi3audit" [project.optional-dependencies] -test = [ - "pytest", - "pytest-cov", - "pretend", - "coverage[toml]", -] -lint = [ - "bandit", - "black", - "isort", - "interrogate", - "mypy", - "ruff", - "types-requests", -] -dev = [ - "build", - "pdoc3", - "abi3audit[test,lint]", -] +test = ["pytest", "pytest-cov", "pretend", "coverage[toml]"] +lint = ["bandit", "interrogate", "mypy", "ruff", "types-requests"] +dev = ["build", "pdoc3", "abi3audit[test,lint]"] [project.scripts] abi3audit = "abi3audit._cli:main" -[tool.isort] -multi_line_output = 3 -known_first_party = "abi3audit" -include_trailing_comma = true - [tool.interrogate] exclude = ["env", "test", "codegen"] ignore-semiprivate = true @@ -93,13 +69,10 @@ warn_unused_ignores = true [tool.bandit] exclude_dirs = ["./test"] -[tool.black] -line-length = 100 - [tool.coverage.run] omit = ["abi3audit/_vendor/*"] [tool.ruff] line-length = 100 -select = ["E", "F", "W", "UP"] +select = ["E", "F", "I", "W", "UP"] target-version = "py38"