Skip to content

Commit

Permalink
Update linters and python version for linting in CI (#15200)
Browse files Browse the repository at this point in the history
x-ref: #15197
  • Loading branch information
hamdanal authored May 7, 2023
1 parent d671b31 commit 6283516
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
# but it's useful to run them with tox too,
# to ensure the tox env works as expected
- name: Formatting with Black + isort and code style with flake8
python: '3.7'
python: '3.10'
arch: x64
os: ubuntu-latest
toxenv: lint
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ repos:
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.11.5 # must match test-requirements.txt (cannot use version 5.12 until python 3.7 support is dropped)
rev: 5.12.0 # must match test-requirements.txt
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 5.0.4 # must match test-requirements.txt (cannot use version 6 until python 3.7 support is dropped)
rev: 6.0.0 # must match test-requirements.txt
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==22.12.6 # must match test-requirements.txt
- flake8-noqa==1.3.0 # must match test-requirements.txt
- flake8-bugbear==23.3.23 # must match test-requirements.txt
- flake8-noqa==1.3.1 # must match test-requirements.txt

ci:
# We run flake8 as part of our GitHub Actions suite in CI
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ python3 -m pip install -e .
hash -r # This resets shell PATH cache, not necessary on Windows
```

> **Note**
> You'll need Python 3.8 or higher to install all requirements listed in
> test-requirements.txt
### Running tests

Running the full test suite can take a while, and usually isn't necessary when
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ force-exclude = '''
'''

[tool.isort]
py_version = 37
profile = "black"
line_length = 99
combine_as_imports = true
Expand Down
8 changes: 4 additions & 4 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
attrs>=18.0
black==23.3.0 # must match version in .pre-commit-config.yaml
filelock>=3.3.0
flake8==5.0.4 # must match version in .pre-commit-config.yaml
flake8-bugbear==22.12.6 # must match version in .pre-commit-config.yaml
flake8-noqa==1.3.0 # must match version in .pre-commit-config.yaml
isort[colors]==5.11.5 # must match version in .pre-commit-config.yaml
flake8==6.0.0; python_version >= "3.8" # must match version in .pre-commit-config.yaml
flake8-bugbear==23.3.23; python_version >= "3.8" # must match version in .pre-commit-config.yaml
flake8-noqa==1.3.1; python_version >= "3.8" # must match version in .pre-commit-config.yaml
isort[colors]==5.12.0; python_version >= "3.8" # must match version in .pre-commit-config.yaml
lxml>=4.9.1; (python_version<'3.11' or sys_platform!='win32') and python_version<'3.12'
psutil>=4.0
# pytest 6.2.3 does not support Python 3.10
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ commands =

[testenv:lint]
description = check the code style
skip_install = true
commands =
flake8 {posargs}
black --check --diff --color .
Expand Down

0 comments on commit 6283516

Please sign in to comment.