From be92a2aff40a96496ffa841287e877ec540e9893 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 4 Nov 2023 19:55:11 -0500 Subject: [PATCH] Clean up lint handling (#888) --- .github/workflows/tests.yml | 2 +- .pre-commit-config.yaml | 9 +++++++++ pyproject.toml | 22 +++++++--------------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0e830581..6c7206d3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,7 +73,7 @@ jobs: - name: Run Linters run: | hatch run typing:test - hatch run lint:style + hatch run lint:build pipx run 'validate-pyproject[all]' pyproject.toml pipx run doc8 --max-line-length=200 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 12f2648f..ece3a06e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,6 +50,15 @@ repos: - id: codespell args: ["-L", "sur,nd"] + - repo: https://github.com/pre-commit/mirrors-mypy + rev: "v1.6.1" + hooks: + - id: mypy + files: "^traitlets" + stages: [manual] + args: ["--install-types", "--non-interactive"] + additional_dependencies: ["argcomplete>=3.1"] + - repo: https://github.com/pre-commit/pygrep-hooks rev: "v1.10.0" hooks: diff --git a/pyproject.toml b/pyproject.toml index 6e944824..856f3557 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,24 +70,16 @@ test = "python -m pytest -vv --cov traitlets --cov-branch --cov-report term-miss nowarn = "test -W default {args}" [tool.hatch.envs.typing] -features = ["test"] +dependencies = ["pre-commit"] +detached = true [tool.hatch.envs.typing.scripts] -test = "mypy --install-types --non-interactive {args}" +test = "pre-commit run --all-files --hook-stage manual mypy" [tool.hatch.envs.lint] -dependencies = ["mdformat>0.7", "ruff==0.1.3"] +dependencies = ["pre-commit"] detached = true [tool.hatch.envs.lint.scripts] -style = [ - "ruff {args:.}", - "ruff format {args:.}", - "mdformat --check {args:docs *.md}" -] -fmt = [ - "ruff --fix {args:.}", - "ruff format {args:.}", - "mdformat {args:docs *.md}" -] +build = ["pre-commit run --all-files ruff"] [tool.mypy] files = "traitlets" @@ -105,7 +97,7 @@ minversion = "6.0" xfail_strict = true log_cli_level = "info" addopts = [ - "-raXs", "--durations=10", "--color=yes", "--doctest-modules", + "-ra", "--durations=10", "--color=yes", "--doctest-modules", "--showlocals", "--strict-markers", "--strict-config", "--ignore=examples/docs/configs" ] @@ -235,4 +227,4 @@ unfixable = [ "traitlets/*__init__.py" = ["F401", "F403"] [tool.repo-review] -ignore = ["PY007", "PP308", "GH102", "PC140", "MY101"] +ignore = ["PY007"]