Skip to content

Commit

Permalink
Replace flake8 + isort with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed May 27, 2024
1 parent b7a85eb commit 629371b
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 39 deletions.
27 changes: 0 additions & 27 deletions .flake8

This file was deleted.

5 changes: 0 additions & 5 deletions .isort.cfg

This file was deleted.

4 changes: 1 addition & 3 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
click==8.0.4
black==24.3.0
cachetools
flake8==5.0.4
flake8-isort==6.0.0
flynt~=0.69.0
mock==4.0.3
packaging>=20.4
Expand All @@ -16,3 +13,4 @@ ujson>=4.2.0
wheel>=0.30.0
urllib3<2
uvloop
ruff==0.4.5
2 changes: 1 addition & 1 deletion redis/_parsers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def parse_geosearch_generic(response, **options):
except KeyError: # it means the command was sent via execute_command
return response

if type(response) != list:
if type(response) != list: # noqa: E721
response_list = [response]
else:
response_list = response
Expand Down
2 changes: 1 addition & 1 deletion redis/commands/timeseries/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, args):
self.chunk_size = response["chunkSize"]
if "duplicatePolicy" in response:
self.duplicate_policy = response["duplicatePolicy"]
if type(self.duplicate_policy) == bytes:
if type(self.duplicate_policy) == bytes: # noqa: E721
self.duplicate_policy = self.duplicate_policy.decode()

def get(self, item):
Expand Down
1 change: 1 addition & 0 deletions redis/ocsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from cryptography.hazmat.primitives.hashes import SHA1, Hash
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
from cryptography.x509 import ocsp

from redis.exceptions import AuthorizationError, ConnectionError


Expand Down
37 changes: 37 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
line-length = 88
exclude = [
"*.egg-info",
"*.pyc",
".git",
".venv*",
".venv*",
"build",
"dist",
"docker",
"docs/*",
"tasks.py",
"venv*",
"whitelist.py",
]
[lint]
ignore = [
"E501",
"E741",
"F405",
"N801",
"N802",
"N803",
"N806",
"N815",
"N818",
]
extend-select = [
"E",
"F",
"N",
"W",
"I",
]
[lint.per-file-ignores]
"redis/commands/search/indexDefinition.py" = ["N999"]
"tests/*" = ["I"]
3 changes: 1 addition & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ def build_docs(c):
@task
def linters(c):
"""Run code linters"""
run("flake8 tests redis")
run("ruff check tests redis")
run("black --target-version py37 --check --diff tests redis")
run("isort --check-only --diff tests redis")
run("vulture redis whitelist.py --min-confidence 80")
run("flynt --fail-on-change --dry-run tests redis")

Expand Down

0 comments on commit 629371b

Please sign in to comment.