diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 63401b8223fc8a8c0cd820fe1f610d43b7a9f9a7..45f7625ba81866bcf5e707c99c03cb04dc8d5da5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,18 +3,13 @@ repos: rev: 22.8.0 hooks: - id: black - - repo: https://github.com/PyCQA/flake8.git - rev: 5.0.4 + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.238 hooks: - - id: flake8 + - id: ruff - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace - id: check-json - - repo: https://github.com/PyCQA/isort.git - rev: 5.10.1 - hooks: - - id: isort - args: ["--profile", "black"] diff --git a/dbformat/__init__.py b/dbformat/__init__.py index 42d523c023a2e29cddd93fdfdb0c9473fdb7f110..f9e281d5551aad45a04623f46b64cf99accb3b1d 100644 --- a/dbformat/__init__.py +++ b/dbformat/__init__.py @@ -6,8 +6,12 @@ import re from pathlib import Path from typing import Optional, Sequence, Tuple +from pkg_resources import get_distribution + from dbformat import rules +__version__ = get_distribution(__name__).version + GUIDELINES = json.loads((Path(__file__).parent / "guidelines.json").read_text()) @@ -60,6 +64,9 @@ def print_guidelines() -> None: def main(argv: Optional[Sequence[str]] = None) -> int: parser = argparse.ArgumentParser() + parser.add_argument( + "-V", "--version", action="version", version=f"{__name__} {__version__}" + ) parser.add_argument("filenames", nargs="*", type=Path, help="filenames to check") parser.add_argument( "--print-guidelines", action="store_true", help="print guidelines and exit" diff --git a/pyproject.toml b/pyproject.toml index 374b58cbf4636f1e28bacf987ac2fe89ed27ccba..fc6f29cbce798ce900128eb21a27098afad38a93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,3 +4,7 @@ requires = [ "wheel" ] build-backend = "setuptools.build_meta" + +[tool.ruff] +extend-select = ["D212"] +extend-ignore = ["D105", "D107", "D202", "D418", "E501"] diff --git a/setup.cfg b/setup.cfg index 7fa164542d9ed8d26ea7e743fa4d9a8e5f0050f8..fa69c2b99192a807bc1231d736965d5164d4e88a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -26,8 +26,3 @@ dev = pytest pytest-cov pre-commit - -[flake8] -ignore = E501, E203, W503 -# E501, E203: black -# W503: PEP8