Switch linting from flake8 to ruff

Signed-off-by: Aarni Koskela <akx@iki.fi>
This commit is contained in:
Aarni Koskela 2023-05-11 15:45:07 +03:00
parent 8a3402c049
commit 9313536601
13 changed files with 20 additions and 22 deletions

View File

@ -6,16 +6,16 @@ env:
DOCKER_BUILDKIT: '1' DOCKER_BUILDKIT: '1'
jobs: jobs:
flake8: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
with: with:
python-version: '3.x' python-version: '3.11'
- run: pip install -U flake8 - run: pip install -U ruff==0.0.284
- name: Run flake8 - name: Run ruff
run: flake8 docker/ tests/ run: ruff docker tests
unit-tests: unit-tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -44,7 +44,7 @@ paragraph in the Docker contribution guidelines.
Before we can review your pull request, please ensure that nothing has been Before we can review your pull request, please ensure that nothing has been
broken by your changes by running the test suite. You can do so simply by broken by your changes by running the test suite. You can do so simply by
running `make test` in the project root. This also includes coding style using running `make test` in the project root. This also includes coding style using
`flake8` `ruff`
### 3. Write clear, self-contained commits ### 3. Write clear, self-contained commits

View File

@ -46,7 +46,7 @@ build-dind-certs:
docker build -t dpy-dind-certs -f tests/Dockerfile-dind-certs . docker build -t dpy-dind-certs -f tests/Dockerfile-dind-certs .
.PHONY: test .PHONY: test
test: flake8 unit-test-py3 integration-dind integration-dind-ssl test: ruff unit-test-py3 integration-dind integration-dind-ssl
.PHONY: unit-test-py3 .PHONY: unit-test-py3
unit-test-py3: build-py3 unit-test-py3: build-py3
@ -163,9 +163,9 @@ integration-dind-ssl: build-dind-certs build-py3 setup-network
docker rm -vf dpy-dind-ssl dpy-dind-certs docker rm -vf dpy-dind-ssl dpy-dind-certs
.PHONY: flake8 .PHONY: ruff
flake8: build-py3 ruff: build-py3
docker run -t --rm docker-sdk-python3 flake8 docker tests docker run -t --rm docker-sdk-python3 ruff docker tests
.PHONY: docs .PHONY: docs
docs: build-docs docs: build-docs

View File

@ -1,4 +1,3 @@
# flake8: noqa
from .api import APIClient from .api import APIClient
from .client import DockerClient, from_env from .client import DockerClient, from_env
from .context import Context from .context import Context

View File

@ -1,2 +1 @@
# flake8: noqa
from .client import APIClient from .client import APIClient

View File

@ -1,3 +1,2 @@
# flake8: noqa
from .context import Context from .context import Context
from .api import ContextAPI from .api import ContextAPI

View File

@ -1,4 +1,4 @@
# flake8: noqa
from .store import Store from .store import Store
from .errors import StoreError, CredentialsNotFound from .errors import StoreError, CredentialsNotFound
from .constants import * from .constants import * # noqa: F403

View File

@ -1,4 +1,3 @@
# flake8: noqa
from .unixconn import UnixHTTPAdapter from .unixconn import UnixHTTPAdapter
from .ssladapter import SSLHTTPAdapter from .ssladapter import SSLHTTPAdapter
try: try:

View File

@ -1,4 +1,3 @@
# flake8: noqa
from .containers import ( from .containers import (
ContainerConfig, HostConfig, LogConfig, Ulimit, DeviceRequest ContainerConfig, HostConfig, LogConfig, Ulimit, DeviceRequest
) )

View File

@ -1,4 +1,4 @@
# flake8: noqa
from .build import create_archive, exclude_paths, mkbuildcontext, tar from .build import create_archive, exclude_paths, mkbuildcontext, tar
from .decorators import check_resource, minimum_version, update_headers from .decorators import check_resource, minimum_version, update_headers
from .utils import ( from .utils import (

View File

@ -3,3 +3,6 @@ requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
[tool.setuptools_scm] [tool.setuptools_scm]
write_to = 'docker/_version.py' write_to = 'docker/_version.py'
[tool.ruff.per-file-ignores]
"**/__init__.py" = ["F401"]

View File

@ -1,6 +1,6 @@
setuptools==65.5.1 setuptools==65.5.1
coverage==6.4.2 coverage==6.4.2
flake8==4.0.1 ruff==0.0.284
pytest==7.1.2 pytest==7.1.2
pytest-cov==3.0.0 pytest-cov==3.0.0
pytest-timeout==2.1.0 pytest-timeout==2.1.0

View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py{37,38,39,310,311}, flake8 envlist = py{37,38,39,310,311}, ruff
skipsdist=True skipsdist=True
[testenv] [testenv]
@ -10,7 +10,7 @@ deps =
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
[testenv:flake8] [testenv:ruff]
commands = flake8 docker tests setup.py commands = ruff docker tests setup.py
deps = deps =
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt