Files

44 lines
1.2 KiB
YAML

name: lint
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
syntax:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: AST-parse all Python files
run: |
python - <<'EOF'
import ast, pathlib, sys
fail = []
for p in sorted(pathlib.Path('.').rglob('*.py')):
if 'lens_source' in p.parts:
continue # vendored, not our code
try:
ast.parse(p.read_text())
print(f'OK {p}')
except SyntaxError as e:
fail.append((p, e))
print(f'ERR {p}: {e}')
if fail:
sys.exit(f'{len(fail)} file(s) failed to parse')
EOF
- name: bash syntax check
run: |
for f in scripts/*.sh; do
bash -n "$f" && echo "OK $f"
done
- name: JSON validity
run: |
for f in $(find . -name '*.json' -not -path './lens_source/*' -not -path './.github/*'); do
python -m json.tool "$f" > /dev/null && echo "OK $f"
done