Skip to content

Commit bd275ba

Browse files
committed
Add ruff formatter
1 parent fdf4cbf commit bd275ba

15 files changed

+33
-50
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
* text eol=lf

.pre-commit-config.yaml

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,19 @@
1-
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
1+
# SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries
22
#
33
# SPDX-License-Identifier: Unlicense
44

55
repos:
6-
- repo: https://github.com/python/black
7-
rev: 24.2.0
8-
hooks:
9-
- id: black
10-
- repo: https://github.com/PyCQA/isort
11-
rev: 5.13.2
12-
hooks:
13-
- id: isort
14-
args: ["--profile", "black", "--filter-files"]
15-
- repo: https://github.com/fsfe/reuse-tool
16-
rev: v1.1.2
17-
hooks:
18-
- id: reuse
196
- repo: https://github.com/pre-commit/pre-commit-hooks
20-
rev: v4.4.0
7+
rev: v4.5.0
218
hooks:
229
- id: check-yaml
2310
- id: end-of-file-fixer
2411
- id: trailing-whitespace
25-
- repo: https://github.com/pycqa/pylint
26-
rev: v2.17.4
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
rev: v0.3.4
14+
hooks:
15+
- id: ruff-format
16+
- repo: https://github.com/fsfe/reuse-tool
17+
rev: v3.0.1
2718
hooks:
28-
- id: pylint
29-
name: pylint (library code)
30-
types: [python]
31-
args:
32-
- --disable=consider-using-f-string
33-
exclude: "^(docs/|examples/|tests/|setup.py$)"
34-
- id: pylint
35-
name: pylint (example code)
36-
description: Run pylint rules on "examples/*.py" files
37-
types: [python]
38-
files: "^examples/"
39-
args:
40-
- --disable=consider-using-f-string,duplicate-code,missing-docstring,invalid-name
41-
- id: pylint
42-
name: pylint (test code)
43-
description: Run pylint rules on "tests/*.py" files
44-
types: [python]
45-
files: "^tests/"
46-
args:
47-
- --disable=consider-using-f-string,duplicate-code,missing-docstring,invalid-name,protected-access,redefined-outer-name
19+
- id: reuse

examples/wifi/expanded/requests_wifi_api_twitter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-License-Identifier: MIT
33
# Coded for Circuit Python 8.0
44
"""DJDevon3 Adafruit Feather ESP32-S2 Twitter_API_Example"""
5+
56
import gc
67
import json
78
import os

examples/wifi/expanded/requests_wifi_api_youtube.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-License-Identifier: MIT
33
# Coded for Circuit Python 8.0
44
"""DJDevon3 Adafruit Feather ESP32-S2 YouTube_API_Example"""
5+
56
import gc
67
import json
78
import os

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ classifiers = [
3838
]
3939
dynamic = ["dependencies", "optional-dependencies"]
4040

41+
[tool.ruff]
42+
target-version = "py38"
43+
44+
[tool.ruff.format]
45+
line-ending = "lf"
46+
4147
[tool.setuptools]
4248
py-modules = ["adafruit_requests"]
4349

tests/chunk_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44

5-
""" Chunk Tests """
5+
"""Chunk Tests"""
66

77
from unittest import mock
88

tests/chunked_redirect_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44

5-
""" Redirection Tests """
5+
"""Redirection Tests"""
66

77
from unittest import mock
88

tests/concurrent_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44

5-
""" Concurrent Tests """
5+
"""Concurrent Tests"""
66

77
import errno
88
from unittest import mock

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44

5-
""" PyTest Setup """
5+
"""PyTest Setup"""
66

77
import adafruit_connection_manager
88
import mocket

tests/header_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44

5-
""" Header Tests """
5+
"""Header Tests"""
66

77
import mocket
88
import pytest

tests/method_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44

5-
""" Post Tests """
5+
"""Post Tests"""
66

77
from unittest import mock
88

tests/mocket.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# SPDX-License-Identifier: Unlicense
55

6-
""" Mock Socket """
6+
"""Mock Socket"""
77

88
from unittest import mock
99

@@ -84,9 +84,7 @@ class SSLContext: # pylint: disable=too-few-public-methods
8484
def __init__(self):
8585
self.wrap_socket = mock.Mock(side_effect=self._wrap_socket)
8686

87-
def _wrap_socket(
88-
self, sock, server_hostname=None
89-
): # pylint: disable=no-self-use,unused-argument
87+
def _wrap_socket(self, sock, server_hostname=None): # pylint: disable=no-self-use,unused-argument
9088
return sock
9189

9290

tests/parse_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44

5-
""" Parse Tests """
5+
"""Parse Tests"""
66

77
import json
88

tests/protocol_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44

5-
""" Protocol Tests """
5+
"""Protocol Tests"""
66

77
from unittest import mock
88

tests/reuse_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: Unlicense
44

5-
""" Reuse Tests """
5+
"""Reuse Tests"""
66

77
from unittest import mock
88

0 commit comments

Comments
 (0)