add flake8 and clean justfile
This commit is contained in:
parent
b58f67b272
commit
ccd87fc22a
3 changed files with 27 additions and 20 deletions
|
|
@ -20,6 +20,7 @@ repos:
|
||||||
description: Check the package for errors.
|
description: Check the package for errors.
|
||||||
entry: cargo check
|
entry: cargo check
|
||||||
language: system
|
language: system
|
||||||
|
args: ["--workspace"]
|
||||||
types: [rust]
|
types: [rust]
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
- id: clippy
|
- id: clippy
|
||||||
|
|
@ -27,7 +28,7 @@ repos:
|
||||||
description: Lint rust sources
|
description: Lint rust sources
|
||||||
entry: cargo clippy
|
entry: cargo clippy
|
||||||
language: system
|
language: system
|
||||||
args: ["--", "-D", "warnings"]
|
args: ["--workspace", "--", "-D", "warnings"]
|
||||||
types: [rust]
|
types: [rust]
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
|
|
@ -53,3 +54,14 @@ repos:
|
||||||
rev: 'v1.5.1'
|
rev: 'v1.5.1'
|
||||||
hooks:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
|
additional_dependencies:
|
||||||
|
- "typing-extensions>=4.0.0"
|
||||||
|
- repo: https://github.com/pycqa/flake8
|
||||||
|
rev: '6.1.0'
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
additional_dependencies:
|
||||||
|
- "Flake8-pyproject"
|
||||||
|
- "flake8-bugbear"
|
||||||
|
- "flake8-pyi"
|
||||||
|
args: ["--toml-config", "pyargus/pyproject.toml"]
|
||||||
|
|
|
||||||
17
justfile
17
justfile
|
|
@ -4,13 +4,12 @@ build *ARGS:
|
||||||
test *ARGS:
|
test *ARGS:
|
||||||
cargo test {{ARGS}}
|
cargo test {{ARGS}}
|
||||||
|
|
||||||
check:
|
pytest *ARGS:
|
||||||
cargo +nightly clippy
|
cd pyargus && pytest {{ARGS}}
|
||||||
cd pyargus && stubtest argus
|
|
||||||
cd pyargus && mypy .
|
|
||||||
cd pyargus && flake8
|
|
||||||
cd pyargus && ruff .
|
|
||||||
|
|
||||||
|
check:
|
||||||
|
pre-commit run -a
|
||||||
|
cd pyargus && stubtest argus
|
||||||
|
|
||||||
test-coverage $CARGO_INCREMENTAL="0" $RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" $RUSTDOCFLAGS="-Cpanic=abort" $LLVM_PROFILE_FILE="argus-%p-%m.profraw":
|
test-coverage $CARGO_INCREMENTAL="0" $RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" $RUSTDOCFLAGS="-Cpanic=abort" $LLVM_PROFILE_FILE="argus-%p-%m.profraw":
|
||||||
fd -e gcda -e profraw --no-ignore -x rm
|
fd -e gcda -e profraw --no-ignore -x rm
|
||||||
|
|
@ -20,12 +19,6 @@ test-coverage $CARGO_INCREMENTAL="0" $RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Co
|
||||||
html-cov: test-coverage
|
html-cov: test-coverage
|
||||||
grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/
|
grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/
|
||||||
|
|
||||||
fmt:
|
|
||||||
fd -e rs -x rustfmt +nightly {}
|
|
||||||
cd pyargus && ruff --fix --exit-non-zero-on-fix .
|
|
||||||
cd pyargus && isort .
|
|
||||||
cd pyargus && black .
|
|
||||||
|
|
||||||
doc:
|
doc:
|
||||||
cargo doc --no-deps
|
cargo doc --no-deps
|
||||||
fd -e md . doc/ -x rustdoc {}
|
fd -e md . doc/ -x rustdoc {}
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,12 @@ classifiers = [
|
||||||
dev = [
|
dev = [
|
||||||
# Type check
|
# Type check
|
||||||
"mypy",
|
"mypy",
|
||||||
|
"typing-extensions",
|
||||||
# Lint code
|
# Lint code
|
||||||
"Flake8-pyproject",
|
|
||||||
"ruff",
|
"ruff",
|
||||||
# Find likely bugs
|
"Flake8-pyproject",
|
||||||
"flake8-bugbear",
|
"flake8-bugbear",
|
||||||
|
"flake8-pyi",
|
||||||
# Sort imports
|
# Sort imports
|
||||||
"isort",
|
"isort",
|
||||||
# Reformat
|
# Reformat
|
||||||
|
|
@ -49,9 +50,12 @@ select = ["E", "F", "W", "N"]
|
||||||
ignore = ["F403"]
|
ignore = ["F403"]
|
||||||
|
|
||||||
[tool.flake8]
|
[tool.flake8]
|
||||||
# line breaks before and after binary operators
|
max-line-length = 127
|
||||||
# ignore explicit stack level
|
max-complexity = 10
|
||||||
ignore = ["W503", "W504", "E203", "E231", "C901", "F403"]
|
per-file-ignores = [
|
||||||
|
"*.py: B905, B907, B950, E203, E501, W503, W291, W293",
|
||||||
|
"*.pyi: B, E301, E302, E305, E501, E701, E704, W503",
|
||||||
|
]
|
||||||
# Ignore import not used when aliases are defined
|
# Ignore import not used when aliases are defined
|
||||||
exclude = [
|
exclude = [
|
||||||
# No need to traverse our git directory
|
# No need to traverse our git directory
|
||||||
|
|
@ -69,8 +73,6 @@ exclude = [
|
||||||
".mypy_cache/",
|
".mypy_cache/",
|
||||||
".ruff_cache/",
|
".ruff_cache/",
|
||||||
]
|
]
|
||||||
max-complexity = 10
|
|
||||||
max-line-length = 127
|
|
||||||
|
|
||||||
[tool.isort]
|
[tool.isort]
|
||||||
profile = "black"
|
profile = "black"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue