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.
|
||||
entry: cargo check
|
||||
language: system
|
||||
args: ["--workspace"]
|
||||
types: [rust]
|
||||
pass_filenames: false
|
||||
- id: clippy
|
||||
|
|
@ -27,7 +28,7 @@ repos:
|
|||
description: Lint rust sources
|
||||
entry: cargo clippy
|
||||
language: system
|
||||
args: ["--", "-D", "warnings"]
|
||||
args: ["--workspace", "--", "-D", "warnings"]
|
||||
types: [rust]
|
||||
pass_filenames: false
|
||||
- repo: https://github.com/psf/black
|
||||
|
|
@ -53,3 +54,14 @@ repos:
|
|||
rev: 'v1.5.1'
|
||||
hooks:
|
||||
- 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:
|
||||
cargo test {{ARGS}}
|
||||
|
||||
check:
|
||||
cargo +nightly clippy
|
||||
cd pyargus && stubtest argus
|
||||
cd pyargus && mypy .
|
||||
cd pyargus && flake8
|
||||
cd pyargus && ruff .
|
||||
pytest *ARGS:
|
||||
cd pyargus && pytest {{ARGS}}
|
||||
|
||||
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":
|
||||
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
|
||||
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:
|
||||
cargo doc --no-deps
|
||||
fd -e md . doc/ -x rustdoc {}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,12 @@ classifiers = [
|
|||
dev = [
|
||||
# Type check
|
||||
"mypy",
|
||||
"typing-extensions",
|
||||
# Lint code
|
||||
"Flake8-pyproject",
|
||||
"ruff",
|
||||
# Find likely bugs
|
||||
"Flake8-pyproject",
|
||||
"flake8-bugbear",
|
||||
"flake8-pyi",
|
||||
# Sort imports
|
||||
"isort",
|
||||
# Reformat
|
||||
|
|
@ -49,9 +50,12 @@ select = ["E", "F", "W", "N"]
|
|||
ignore = ["F403"]
|
||||
|
||||
[tool.flake8]
|
||||
# line breaks before and after binary operators
|
||||
# ignore explicit stack level
|
||||
ignore = ["W503", "W504", "E203", "E231", "C901", "F403"]
|
||||
max-line-length = 127
|
||||
max-complexity = 10
|
||||
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
|
||||
exclude = [
|
||||
# No need to traverse our git directory
|
||||
|
|
@ -69,8 +73,6 @@ exclude = [
|
|||
".mypy_cache/",
|
||||
".ruff_cache/",
|
||||
]
|
||||
max-complexity = 10
|
||||
max-line-length = 127
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue