File tree Expand file tree Collapse file tree 6 files changed +154
-55
lines changed
Expand file tree Collapse file tree 6 files changed +154
-55
lines changed Original file line number Diff line number Diff line change 1+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python/.flake8
2+ # See: https://flake8.pycqa.org/en/latest/user/configuration.html
3+ # The code style defined in this file is the official standardized style to be used in all Arduino tooling projects and
4+ # should not be modified.
5+
16[flake8]
27doctests = True
3- ignore =
4- # W503 and W504 are mutually exclusive, so one or the other must be ignored.
5- # PEP 8 recommends line break before, so we keep W504.
6- W503
8+ # W503 and W504 are mutually exclusive. PEP 8 recommends line break before.
9+ ignore = W503
710max-complexity = 10
811max-line-length = 120
912select = E,W,F,C,N
Original file line number Diff line number Diff line change 1+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-python-task.md
2+ name : Check Python
3+
4+ env :
5+ # See: https://github.com/actions/setup-python/tree/v2#available-versions-of-python
6+ PYTHON_VERSION : " 3.9"
7+
8+ # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
9+ on :
10+ push :
11+ paths :
12+ - " .github/workflows/check-python-task.ya?ml"
13+ - " **/.flake8"
14+ - " **/poetry.lock"
15+ - " **/pyproject.toml"
16+ - " **/setup.cfg"
17+ - " Taskfile.ya?ml"
18+ - " **/tox.ini"
19+ - " **.py"
20+ pull_request :
21+ paths :
22+ - " .github/workflows/check-python-task.ya?ml"
23+ - " **/.flake8"
24+ - " **/poetry.lock"
25+ - " **/pyproject.toml"
26+ - " **/setup.cfg"
27+ - " Taskfile.ya?ml"
28+ - " **/tox.ini"
29+ - " **.py"
30+ workflow_dispatch :
31+ repository_dispatch :
32+
33+ jobs :
34+ lint :
35+ runs-on : ubuntu-latest
36+
37+ steps :
38+ - name : Checkout repository
39+ uses : actions/checkout@v2
40+
41+ - name : Install Python
42+ uses : actions/setup-python@v2
43+ with :
44+ python-version : ${{ env.PYTHON_VERSION }}
45+
46+ - name : Install Poetry
47+ run : pip install poetry
48+
49+ - name : Install Task
50+ uses : arduino/setup-task@v1
51+ with :
52+ repo-token : ${{ secrets.GITHUB_TOKEN }}
53+ version : 3.x
54+
55+ - name : Run flake8
56+ uses : liskin/gh-problem-matcher-wrap@v1
57+ with :
58+ linters : flake8
59+ run : task python:lint
60+
61+ formatting :
62+ runs-on : ubuntu-latest
63+
64+ steps :
65+ - name : Checkout repository
66+ uses : actions/checkout@v2
67+
68+ - name : Install Python
69+ uses : actions/setup-python@v2
70+ with :
71+ python-version : ${{ env.PYTHON_VERSION }}
72+
73+ - name : Install Poetry
74+ run : pip install poetry
75+
76+ - name : Install Task
77+ uses : arduino/setup-task@v1
78+ with :
79+ repo-token : ${{ secrets.GITHUB_TOKEN }}
80+ version : 3.x
81+
82+ - name : Format Python code
83+ run : task python:format
84+
85+ - name : Check formatting
86+ run : git diff --color --exit-code
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ includes:
44 dist : ./DistTasks.yml
55
66tasks :
7+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
78 poetry:install-deps :
89 desc : Install dependencies managed by Poetry
910 cmds :
@@ -190,16 +191,20 @@ tasks:
190191 cmds :
191192 - task : python:lint
192193
194+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python-task/Taskfile.yml
193195 python:lint :
194196 desc : Lint Python code
195- cmds :
197+ deps :
196198 - task : poetry:install-deps
197- - poetry run flake8
199+ cmds :
200+ - poetry run flake8 --show-source
198201
202+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python-task/Taskfile.yml
199203 python:format :
200- desc : Automatically formats Python files
201- cmds :
204+ desc : Format Python files
205+ deps :
202206 - task : poetry:install-deps
207+ cmds :
203208 - poetry run black .
204209
205210vars :
Original file line number Diff line number Diff line change @@ -13,13 +13,14 @@ python-dateutil = "^2.8.1"
1313
1414[tool .poetry .dev-dependencies ]
1515flake8 = " ^3.9.2"
16- black = " ^21.5b1 "
16+ black = " ^21.7b0 "
1717mkdocs = " ^1.2.1"
1818mkdocs-material = " ^7.1.8"
1919mdx-truly-sane-lists = " ^1.2"
2020click = " <7.2"
2121GitPython = " ^3.1.1"
2222mike = " ^1.0.1"
23+ pep8-naming = " ^0.12.1"
2324
2425[tool .black ]
2526line-length = 120
You can’t perform that action at this time.
0 commit comments