-
Notifications
You must be signed in to change notification settings - Fork 39
45 lines (37 loc) · 1.45 KB
/
linting.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
# This workflow will perform linting on the changed python files of a push or
# pull request and on the full codebase. For the full# codebase it will not fail
# if there are linting errors, for the changed files it will fail.
name: Linting
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
- name: Setup Python environment
uses: actions/setup-python@v3
- name: Install flake8
run: pip install flake8
- name: Run flake8 on full codebase
continue-on-error: true
# W291 Trailing whitespace
# W292 No newline at end of file
# W293 Blank line contains whitespace
# W391 Blank line at end of file
# E999 SyntaxError
# (Exclude the automatically generated files)
run: flake8 . --select W291,W292,W293,W391,E999 --exclude src/odemis/gui/main_xrc.py,src/odemis/gui/win/dialog_xrc.py
- name: Run flake8 on changed files
run: |
for changed_file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ $changed_file == *.py ]]
then
flake8 "$changed_file" --select W291,W292,W293,W391,E999 --exclude src/odemis/gui/main_xrc.py,src/odemis/gui/win/dialog_xrc.py
fi
done