File tree Expand file tree Collapse file tree 3 files changed +24
-17
lines changed Expand file tree Collapse file tree 3 files changed +24
-17
lines changed Original file line number Diff line number Diff line change 20
20
with :
21
21
bazel-target-prefix : ' //py'
22
22
23
- tox_flake8 :
23
+ tox_linting :
24
24
if : ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run python]') == true }}
25
25
needs : check_workflow
26
26
runs-on : ubuntu-latest
38
38
- name : Test with tox
39
39
run : tox -c py/tox.ini
40
40
env :
41
- TOXENV : flake8
41
+ TOXENV : linting
42
42
43
43
tox_docs :
44
44
if : ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run python]') == true }}
Original file line number Diff line number Diff line change @@ -144,3 +144,16 @@ View source code online:
144
144
+-----------+------------------------------------------------------+
145
145
| official: | https://github.com/SeleniumHQ/selenium/tree/trunk/py |
146
146
+-----------+------------------------------------------------------+
147
+
148
+
149
+ Contributing
150
+ =============
151
+
152
+ - Create a branch for your work
153
+ - Ensure `tox ` is installed (using a `virtualenv ` is recommended)
154
+ - `python3.7 -m venv .venv && . .venv/bin/activate && pip install tox `
155
+ - After making changes, before committing execute `tox -e linting `
156
+ - If tox exits `0 `, commit and push otherwise fix the newly introduced breakages.
157
+ - `flake8 ` requires manual fixes
158
+ - `black ` will often rewrite the breakages automatically, however the files are unstaged and should staged again.
159
+ - `isort ` will often rewrite the breakages automatically, however the files are unstaged and should staged again.
Original file line number Diff line number Diff line change 9
9
10
10
commands = sphinx-build -b html -d ../build/doctrees docs/source ../build/docs/api/py {posargs}
11
11
12
- [testenv:flake8]
13
- skip_install = true
14
- deps = flake8
15
- flake8-typing-imports
16
- commands = flake8 {posargs} --min-python-version =3.7
17
-
18
12
19
13
[testenv:mypy]
20
14
skip_install = true
@@ -35,18 +29,18 @@ profile = black
35
29
py_version =37
36
30
force_single_line = True
37
31
38
- [testenv:isort]
39
- skip_install = true
40
- deps =
41
- isort ==5.10.1
42
- commands = isort selenium/ test/
43
32
44
- [testenv:black ]
45
- ; black is a common python code formatter. This allows us to keep code completely
46
- ; consistent throughout all contributions and reduce merge conflicts in future .
47
- ; Right now it is opt in and not enforced in CI but will be in future .
33
+ [testenv:linting ]
34
+ ; A consolidated linting based recipe, responsible for executing linting tools across the code base.
35
+ ; This encompasses isort for imports, black for general formatting and flake8 .
36
+ ; IMPORTANT: black & isort rewrite files, flake8 merely alerts to the failure .
48
37
skip_install = true
49
38
deps =
39
+ isort ==5.10.1
50
40
black ==22.8.0
41
+ flake8 ==5.0.4
42
+ flake8-typing-imports ==1.13.0
51
43
commands =
44
+ isort selenium/ test/
52
45
black test/ -l 120
46
+ flake8 selenium/ test/ --min-python-version =3.7
You can’t perform that action at this time.
0 commit comments