Skip to content

Commit

Permalink
enable a bunch of ruff rules
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasf committed Jul 12, 2023
1 parent 093546a commit 1e47fbe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
4 changes: 2 additions & 2 deletions minio_storage/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _open(self, name, mode="rb"):
try:
f = self.file_class(self._sanitize_path(name), mode, self)
except merr.MinioException as e:
raise minio_error(f"File {name} could not be saved: {str(e)}", e) from e
raise minio_error(f"File {name} could not be saved: {e!s}", e) from e
return f

def _save(self, name: str, content: T.BinaryIO) -> str:
Expand All @@ -170,7 +170,7 @@ def delete(self, name: str) -> None:
obj = self.client.get_object(self.bucket_name, name)
except merr.InvalidResponseError as error:
raise minio_error(
"Could not obtain file {} " "to make a copy of it".format(name),
f"Could not obtain file {name} to make a copy of it",
error,
) from error

Expand Down
18 changes: 15 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,27 @@ profile = "black"
skip = [".tox", "migrations", "node_modules", ".git", ".eggs"]

[tool.ruff]
target-version = 'py38'
line-length = 88
select = [
"B",
"C4",
"C9",
"DJ",
"E",
"F",
"W",
"I",
"B",
"ISC",
"NPY",
"PLC",
"PLE",
"PLW",
"RUF010",
"RUF013",
"S5",
"S6",
"UP",
"DJ",
"W",
]
ignore = ["E203"]
exclude = [
Expand Down
6 changes: 3 additions & 3 deletions tests/django_minio_storage_tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@
"NAME": "django.contrib.auth.password_validation"
".UserAttributeSimilarityValidator"
},
{"NAME": "django.contrib.auth.password_validation" ".MinimumLengthValidator"},
{"NAME": "django.contrib.auth.password_validation" ".CommonPasswordValidator"},
{"NAME": "django.contrib.auth.password_validation" ".NumericPasswordValidator"},
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
{"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
]


Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ setenv=
PYTHONWARNINGS=ignore
basepython = python3
deps =
ruff==0.0.270
ruff==0.0.277
black==22.3.0
commands =
ruff check .
Expand All @@ -77,7 +77,7 @@ setenv=
basepython = python3
deps =
pyupgrade-directories
ruff==0.0.270
ruff==0.0.277
isort==5.12.0
black==23.3.0
commands =
Expand Down

0 comments on commit 1e47fbe

Please sign in to comment.