Skip to content

Commit

Permalink
[py]: Exit 1 in ci when linter is failing
Browse files Browse the repository at this point in the history
  • Loading branch information
symonk committed Oct 2, 2022
1 parent c09027b commit ca217d2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Test with tox
run: tox -c py/tox.ini
env:
TOXENV: linting
TOXENV: linting-check

tox_docs:
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run python]') == true }}
Expand Down
15 changes: 15 additions & 0 deletions py/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ py_version=37
force_single_line = True


[testenv:linting-check]
; checks linting for CI with stricter exiting when failing.
skip_install = true
deps =
isort==5.10.1
black==22.8.0
flake8==5.0.4
flake8-typing-imports==1.13.0
commands =
; execute isort in check only mode.
isort --check-only --diff selenium/ test/
; execute black in check only mode with diff.
black --check --diff test/ selenium/common/ selenium/webdriver/safari -l 120
flake8 selenium/ test/ --min-python-version=3.7

[testenv:linting]
; A consolidated linting based recipe, responsible for executing linting tools across the code base.
; This encompasses isort for imports, black for general formatting and flake8.
Expand Down

0 comments on commit ca217d2

Please sign in to comment.