Skip to content

Commit

Permalink
Clean up lint handling (#888)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Nov 5, 2023
1 parent 008708a commit be92a2a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
22 changes: 7 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
]
Expand Down Expand Up @@ -235,4 +227,4 @@ unfixable = [
"traitlets/*__init__.py" = ["F401", "F403"]

[tool.repo-review]
ignore = ["PY007", "PP308", "GH102", "PC140", "MY101"]
ignore = ["PY007"]

0 comments on commit be92a2a

Please sign in to comment.