Hanno Böck commited on 2024-12-31 18:51:38
Zeige 2 geänderte Dateien mit 51 Einfügungen und 0 Löschungen.
... | ... |
@@ -0,0 +1,29 @@ |
1 |
+# last update: 2024-12-07 |
|
2 |
+# https://github.com/hannob/codingstyle |
|
3 |
+--- |
|
4 |
+name: runpyci |
|
5 |
+"on": |
|
6 |
+ - pull_request |
|
7 |
+ - push |
|
8 |
+ |
|
9 |
+jobs: |
|
10 |
+ build: |
|
11 |
+ strategy: |
|
12 |
+ matrix: |
|
13 |
+ python-version: [3.9, 3.x, 3.14-dev] |
|
14 |
+ runs-on: ubuntu-latest |
|
15 |
+ steps: |
|
16 |
+ - uses: actions/checkout@v4 |
|
17 |
+ - name: Set up Python ${{ matrix.python-version }} ${{ matrix.os }} |
|
18 |
+ uses: actions/setup-python@v5 |
|
19 |
+ with: |
|
20 |
+ python-version: ${{ matrix.python-version }} |
|
21 |
+ - name: Install dependencies and linters |
|
22 |
+ run: | |
|
23 |
+ [ -e requirements.txt ] && pip install -r requirements.txt |
|
24 |
+ pip install pycodestyle pyupgrade pyflakes dlint pylint ruff |
|
25 |
+ - name: Run tests |
|
26 |
+ env: |
|
27 |
+ RUN_ONLINETESTS: 1 |
|
28 |
+ run: | |
|
29 |
+ ./runpyci.sh |
... | ... |
@@ -0,0 +1,22 @@ |
1 |
+#!/bin/bash |
|
2 |
+# last update: 2024-12-07/2 |
|
3 |
+# https://github.com/hannob/codingstyle |
|
4 |
+set -euo pipefail |
|
5 |
+ |
|
6 |
+PYLINTIG="consider-using-with,design,fixme,invalid-name,missing-docstring,modified-iterating-list,no-member,possibly-used-before-assignment,protected-access,too-many-lines,unused-argument,broad-exception-caught,c-extension-no-member,duplicate-code,global-statement,global-variable-not-assigned,import-error,import-outside-toplevel,inconsistent-return-statements,redefined-outer-name,unspecified-encoding" |
|
7 |
+RUFFIG="ANN,C90,D,FIX001,FIX002,ICN001,PLR0911,PLR0912,PLR0913,PLR0915,PTH,S314,S320,S501,S603,SLF001,T201,TD002,TD003,B008,BLE001,COM812,FBT002,I001,N802,N806,PERF203,PERF401,PLR2004,PLW0602,PLW0603,PT009,RET505,RUF100,S202,S310,S607,S608,SIM102,SIM105,SIM108,SIM113,SIM114,SIM115,TD001,TD004,TRY300" |
|
8 |
+ |
|
9 |
+pyfind=$(find -name \*.py) |
|
10 |
+pygrep=$(grep -rl --exclude-dir=.ruff_cache '^#!/usr/bin/python\|^#!/usr/bin/env python' .) |
|
11 |
+pyfiles=$(echo "$pyfind" "$pygrep" | sort -u) |
|
12 |
+ |
|
13 |
+pycodestyle --max-line-length=100 --ignore=W503,E203 $pyfiles |
|
14 |
+pyupgrade --py313-plus $pyfiles |
|
15 |
+pyflakes $pyfiles |
|
16 |
+flake8 --select=DUO --ignore=DUO107,DUO123,DUO131 $pyfiles |
|
17 |
+pylint --disable=$PYLINTIG $pyfiles |
|
18 |
+ruff check --line-length=100 --select=ALL --ignore=$RUFFIG $pyfiles |
|
19 |
+ |
|
20 |
+if [ -d tests ]; then |
|
21 |
+ python -m unittest -v |
|
22 |
+fi |
|
0 | 23 |