-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add lint & test tooling for Aider
Aider (the AI coding assistant) can run and react to linter and test output automatically. I use Aider occasionally, so this helps in that workflow.
- Loading branch information
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
AIDER_LINT_CMD=./run-lint.sh | ||
AIDER_TEST_CMD=./run-tests.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
|
||
VENV=$HOME/.virtualenvs/darker | ||
PIP=${VENV}/bin/pip | ||
[ ! -f ${PIP} ] && python -m venv ${VENV} && ${PIP} install -U pip | ||
${PIP} install -q -e '.[color,test,release]' | ||
${PIP} uninstall -q -y ruff | ||
|
||
ensure() { command -v $1 >/dev/null || ${PIP} install -q $1; } | ||
|
||
ensure black | ||
ensure codespell | ||
|
||
errors=0 | ||
|
||
source ${VENV}/bin/activate | ||
for file in "$@"; do | ||
case "$file" in | ||
*.py) | ||
darker --quiet --isort --revision origin/main "$file" || errors=$? | ||
graylint --quiet --revision origin/main \ | ||
--lint mypy \ | ||
--lint "ruff check" \ | ||
--lint "codespell" \ | ||
"$file" || errors=$? | ||
;; | ||
*.sh|*.md|*.rst|*.txt) | ||
codespell "$file" || errors=$? | ||
;; | ||
esac | ||
done | ||
deactivate | ||
|
||
exit $errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
VENV=$HOME/.virtualenvs/darker | ||
PIP=${VENV}/bin/pip | ||
[ ! -f ${PIP} ] && python -m venv ${VENV} && ${PIP} install -U pip | ||
${PIP} install -q -e '.[color,test,release]' | ||
|
||
errors=0 | ||
${VENV}/bin/pytest || errors=$? | ||
|
||
exit $errors |