Skip to content

Commit 94e64c6

Browse files
authored
Merge pull request #770 from akx/ruff-minimal
Replace flake8 + isort + bandit with ruff
2 parents a2d01de + c9e7f83 commit 94e64c6

File tree

6 files changed

+36
-29
lines changed

6 files changed

+36
-29
lines changed

pyproject.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[tool.ruff]
2+
line-length = 167
3+
4+
ignore = [
5+
"E402", # TODO: enable
6+
"E711", # TODO: enable
7+
"E711", # TODO: enable
8+
"E712", # TODO: enable
9+
"E721", # TODO: enable
10+
"S101", # TODO: enable
11+
"S110", # TODO: enable
12+
"S324", # TODO: enable
13+
]
14+
extend-select = [
15+
"S", # Bandit
16+
"E9",
17+
"F63",
18+
"F7",
19+
"F82",
20+
"I",
21+
]
22+
23+
[tool.ruff.per-file-ignores]
24+
"{test,tests,examples}/**/*.py" = [
25+
"E741",
26+
"F401",
27+
"F811",
28+
"F841",
29+
"I",
30+
"S",
31+
]

src/paho/mqtt/client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import logging
1919
import string
2020
import struct
21-
import sys
2221
import threading
2322
import time
2423
import uuid
@@ -3550,7 +3549,6 @@ def _handle_pubackcomp(self, cmd):
35503549
return MQTT_ERR_SUCCESS
35513550

35523551
def _handle_on_message(self, message):
3553-
matched = False
35543552

35553553
try:
35563554
topic = message.topic

src/paho/mqtt/properties.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"""
1818

1919
import struct
20-
import sys
2120

2221
from .packettypes import PacketTypes
2322

src/paho/mqtt/reasoncodes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*******************************************************************
1717
"""
1818

19-
import sys
2019

2120
from .packettypes import PacketTypes
2221

test/paho_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ def gen_connack(flags=0, rc=0, proto_ver=4, properties=b"", property_helper=True
501501

502502
packet = struct.pack('!BBBB', 32, 2+len(properties), flags, rc) + properties
503503
else:
504-
packet = struct.pack('!BBBB', 32, 2, flags, rc);
504+
packet = struct.pack('!BBBB', 32, 2, flags, rc)
505505

506506
return packet
507507

tox.ini

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,26 @@ envlist = py{37,38,39}
55
whitelist_externals = echo make
66
deps =
77
-rrequirements.txt
8-
flake8
8+
ruff==0.1.8
99
allowlist_externals =
1010
echo
1111
make
1212
commands =
13-
# $EXCLUDE is defined above in testenv:py27 as a workaround for Python 2
14-
# which does not support asyncio and type hints
15-
flake8 . --count --select=E9,F63,F7,F822,F823 --show-source --statistics {env:EXCLUDE:}
13+
ruff .
1614
python setup.py test
1715
make -C test test
18-
# TODO (cclauss) Fix up all these undefined names
19-
flake8 . --count --exit-zero --select=F821 --show-source --statistics
2016

21-
# On older Python, flake8 version 4 fail with:
22-
# RecursionError: maximum recursion depth exceeded
23-
[testenv:py37]
24-
deps =
25-
-rrequirements.txt
26-
flake8<4
27-
28-
# This lint environment should be the same as the one in .github/work
2917
[testenv:lint]
3018
deps =
31-
bandit
19+
-e .
3220
black
3321
codespell
34-
flake8
35-
isort
3622
mypy
37-
pytest
38-
pyupgrade
23+
ruff==0.1.8
3924
safety
40-
-e .
4125
commands =
4226
# The "-" in front of command tells tox to ignore errors
43-
bandit --recursive --skip B101,B105,B106,B110,B303,B404,B603,B324 src
4427
- black --check src
4528
- codespell
46-
flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics
47-
flake8 src --count --exit-zero --max-complexity=29 --max-line-length=167 --show-source --statistics
48-
isort --check-only --profile black src
4929
- mypy --ignore-missing-imports src
5030
safety check

0 commit comments

Comments
 (0)