-
Notifications
You must be signed in to change notification settings - Fork 3
145 lines (115 loc) · 4.79 KB
/
code_quality.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
142
143
144
145
name: CodeQuality
on:
push:
branches:
- master
- '[1-9].*.x'
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
ReMark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18'
- run: npm install --global remark-cli remark-validate-links remark-lint-no-dead-urls
- run: make remark
Flake_8_syntax_errors:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.8
# see https://github.com/BSFishy/pip-action
- uses: BSFishy/pip-action@v1
with:
packages: |
flake8
- name: Run flake8
# stop the build if there are Python syntax errors or undefined names
# E9 tests are about Python syntax errors usually raised because flake8 can not build an Abstract Syntax Tree (AST). Often these issues are a sign of unused code or code that has not been ported to Python 3. These would be compile-time errors in a compiled language but in a dynamic language like Python they result in the script halting/crashing on the user.
# F63 tests are usually about the confusion between identity and equality in Python. Use ==/!= to compare str, bytes, and int literals is the classic case. These are areas where a == b is True but a is b is False (or vice versa).
# F7 tests logic errors and syntax errors in type hints
# F82 tests are almost always undefined names which are usually a sign of a typo, missing imports, or code that has not been ported to Python 3. These also would be compile-time errors in a compiled language but in Python a NameError is raised which will halt/crash the script on the user.
run: flake8 --count --select=E9,F63,F7,F82 --show-source --statistics ./src ./test_tools ./tests
Flake_8_full_report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.8
# see https://github.com/BSFishy/pip-action
- uses: BSFishy/pip-action@v1
with:
packages: |
flake8
- name: Run flake8
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
run: flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics ./src ./test_tools ./tests
PyCodeStyle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.8
# see https://github.com/BSFishy/pip-action
- uses: BSFishy/pip-action@v1
with:
packages: |
pycodestyle
- name: Run pycodestyle
run: pycodestyle --count --max-line-length=127 --statistics --ignore=E402,E501,W503 ./src ./test_tools ./tests
PyLint-soft:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.8
# see https://github.com/BSFishy/pip-action
- uses: BSFishy/pip-action@v1
with:
packages: |
pylint==2.15.9
- name: Get version
run: pylint --version
- name: Run pylint
run: pylint -f colorized -r y --fail-under 8.9 ./src ./test_tools ./tests
PyLint-hard:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.8
# see https://github.com/BSFishy/pip-action
- uses: BSFishy/pip-action@v1
with:
packages: |
pylint==2.15.9
- name: Get version
run: pylint --version
- name: Run pylint
run: pylint -f colorized -r y --disable=duplicate-except --disable=duplicate-code --disable=no-name-in-module --disable=too-many-lines --disable=line-too-long --disable=redefined-outer-name --disable=c-extension-no-member --disable=import-outside-toplevel --disable=too-many-locals --disable=redefined-builtin --disable=too-many-arguments --disable=wrong-import-position --disable=too-many-statements --disable=too-many-branches ./src ./test_tools ./tests
AutoPEP8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.8
# see https://github.com/BSFishy/pip-action
- uses: BSFishy/pip-action@v1
with:
packages: |
autopep8
- name: Run autopep8
run: autopep8 --recursive --diff --aggressive --aggressive --exit-code --ignore=E402,E501,W503 ./src ./test_tools ./tests