-
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (125 loc) · 4.82 KB
/
linter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Linter
on: [push, pull_request]
concurrency:
group: linter-${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow, github.event.pull_request.number) || github.workflow_ref }}
cancel-in-progress: true
jobs:
ruff-lint:
name: Ruff Linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- uses: chartboost/ruff-action@v1
with:
args: 'check --select ASYNC,C90,DJ,DTZ,E,F,I,NPY,PD,PERF,PT,RUF,SIM,UP,W --ignore E501,F401,F841 --output-format github --diff --exclude fl_client/migrations,fl_server/migrations'
ruff-fix:
name: Ruff Fixer
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- uses: chartboost/ruff-action@v1
with:
args: 'check --fix --ignore F841'
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'style fixes by ruff'
commit_options: '--no-verify --signoff'
skip_checkout: true
push_options: '--force'
branch: 'black'
flake8-lint:
runs-on: ubuntu-latest
name: Flake8
steps:
- name: Check out source repository
uses: actions/checkout@v4
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'
- name: flake8 Lint
uses: py-actions/[email protected]
with:
update-pip: "true"
exclude: "manage.py,fl_client/migrations,fl_server/migrations,settings.py"
ignore: "E501,F401,F841,I900,PIE786,S106,S311,TOR401,W503,W504"
max-line-length: "80"
plugins: "flake8-builtins flake8-commas flake8-errmsg flake8-fixme pep8-naming flake8-pie flake8-use-pathlib flake8-return flake8-type-checking flake8-todo flake8-tidy-imports flake8-bugbear flake8-django flake8-bandit TorchFix pandas-vet flake8-logging-format flake8-requirements"
dj-lint:
runs-on: ubuntu-latest
name: Django Lint
steps:
- name: Check out source repository
uses: actions/checkout@v4
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
- name: DjLint Linter
run: |
python -m pip install --upgrade pip
pip install djlint
djlint ./templates --extension=html --lint
pylint:
name: PyLint
needs: [dj-lint,flake8-lint,ruff-lint]
strategy:
max-parallel: 15
matrix:
os: [macos-12, macos-13, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-2019, windows-2022]
python-version: ["3.10", "3.11", "3.12"]
exclude:
- os: windows-2019
python-version: "3.10"
- os: windows-2022
python-version: "3.10"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: 'pip'
- name: Install dependencies
if: ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13' || matrix.os == 'macos-14' }}
run: |
python -m pip install --upgrade pip
python -m pip install uv
python -m uv pip install pylint
python -m uv pip install git+https://github.com/pylint-dev/pylint-django.git
python -m uv pip install -r requirements.txt
- name: Install dependencies on Windows
if: ${{ matrix.os == 'windows-2019' || matrix.os == 'windows-2022' }}
run: |
python -m pip install --upgrade pip
python -m pip install uv
python -m uv pip install pylint
python -m uv pip install git+https://github.com/pylint-dev/pylint-django.git
python -m uv pip install -r requirements.txt
- name: Install dependencies on Ubuntu
if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' }}
run: |
python -m pip install --upgrade pip
python -m pip install uv
python -m uv pip install pylint
python -m uv pip install git+https://github.com/pylint-dev/pylint-django.git
python -m uv pip install -r requirements.txt
- name: Analysing the code with pylint
run: pylint --load-plugins pylint_django --django-settings-module=lab.settings "**/*.py"