46 lines
1.2 KiB
YAML
46 lines
1.2 KiB
YAML
name: lint
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- "**.py"
|
|
- ".pylintrc"
|
|
- ".gitea/workflows/lint.yml"
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install dev dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements-dev.txt
|
|
|
|
- name: Run pylint
|
|
run: |
|
|
# Pylint's normal exit code is nonzero for any emitted finding,
|
|
# regardless of --fail-under. Preserve the full report but enforce
|
|
# the aggregate score this workflow promises.
|
|
set +e
|
|
find . -name '*.py' -not -path './.venv/*' -not -path './.git/*' \
|
|
| xargs pylint --fail-under=8.0 \
|
|
| tee /tmp/pylint-output.txt
|
|
set -e
|
|
SCORE=$(sed -n \
|
|
's/^Your code has been rated at \([-0-9.]*\)\/10.*/\1/p' \
|
|
/tmp/pylint-output.txt | tail -1)
|
|
test -n "$SCORE"
|
|
awk -v score="$SCORE" 'BEGIN { exit !(score >= 8.0) }'
|
|
|
|
- name: Run pyright
|
|
run: |
|
|
# Run pyright type checking
|
|
pyright .
|