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'
jobs:
flake8:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- run: pip install -U flake8
- name: Run flake8
run: flake8 docker/ tests/
python-version: '3.11'
- run: pip install -U ruff==0.0.284
- name: Run ruff
run: ruff docker tests
unit-tests:
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
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
`flake8`
`ruff`
### 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 .
.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
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
.PHONY: flake8
flake8: build-py3
docker run -t --rm docker-sdk-python3 flake8 docker tests
.PHONY: ruff
ruff: build-py3
docker run -t --rm docker-sdk-python3 ruff docker tests
.PHONY: docs
docs: build-docs

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
# flake8: noqa
from .store import Store
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 .ssladapter import SSLHTTPAdapter
try:

View File

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

View File

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

View File

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

View File

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

View File

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