Skip to content

Commit

Permalink
Switch linting from flake8 to ruff
Browse files Browse the repository at this point in the history
Signed-off-by: Aarni Koskela <akx@iki.fi>
  • Loading branch information
akx committed Aug 15, 2023
1 parent 8a3402c commit 9313536
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 22 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion docker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
from .api import APIClient
from .client import DockerClient, from_env
from .context import Context
Expand Down
1 change: 0 additions & 1 deletion docker/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# flake8: noqa
from .client import APIClient
1 change: 0 additions & 1 deletion docker/context/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# flake8: noqa
from .context import Context
from .api import ContextAPI
4 changes: 2 additions & 2 deletions docker/credentials/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa

from .store import Store
from .errors import StoreError, CredentialsNotFound
from .constants import *
from .constants import * # noqa: F403
1 change: 0 additions & 1 deletion docker/transport/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
from .unixconn import UnixHTTPAdapter
from .ssladapter import SSLHTTPAdapter
try:
Expand Down
1 change: 0 additions & 1 deletion docker/types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
from .containers import (
ContainerConfig, HostConfig, LogConfig, Ulimit, DeviceRequest
)
Expand Down
2 changes: 1 addition & 1 deletion docker/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{37,38,39,310,311}, flake8
envlist = py{37,38,39,310,311}, ruff
skipsdist=True

[testenv]
Expand All @@ -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

0 comments on commit 9313536

Please sign in to comment.