mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
ruff: enable a few more rules, and merge tests' config with the main config (#9739)
This commit is contained in:
@@ -21,7 +21,7 @@ class CmdDestroy(CmdBase):
|
||||
)
|
||||
|
||||
if not self.args.force and not ui.confirm(statement):
|
||||
raise DvcException(
|
||||
raise DvcException( # noqa: TRY301
|
||||
"cannot destroy without a confirmation from the user."
|
||||
" Use `-f` to force."
|
||||
)
|
||||
|
||||
@@ -115,7 +115,9 @@ class TempDirQueue(WorkspaceQueue):
|
||||
message=message,
|
||||
)
|
||||
if not exec_result.exp_hash:
|
||||
raise DvcException(f"Failed to reproduce experiment '{rev[:7]}'")
|
||||
raise DvcException( # noqa: TRY301
|
||||
f"Failed to reproduce experiment '{rev[:7]}'"
|
||||
)
|
||||
if exec_result.ref_info:
|
||||
results[rev].update(
|
||||
self.collect_executor(self.repo.experiments, executor, exec_result)
|
||||
|
||||
@@ -121,7 +121,9 @@ class WorkspaceQueue(BaseStashQueue):
|
||||
message=kwargs.get("message"),
|
||||
)
|
||||
if not exec_result.exp_hash:
|
||||
raise DvcException(f"Failed to reproduce experiment '{rev[:7]}'")
|
||||
raise DvcException( # noqa: TRY301
|
||||
f"Failed to reproduce experiment '{rev[:7]}'"
|
||||
)
|
||||
if exec_result.ref_info:
|
||||
results[rev].update(
|
||||
self.collect_executor(self.repo.experiments, executor, exec_result)
|
||||
|
||||
@@ -134,7 +134,7 @@ class Plots:
|
||||
if "workspace" in revs:
|
||||
# reorder revs to match repo.brancher ordering
|
||||
revs.remove("workspace")
|
||||
revs = ["workspace"] + revs
|
||||
revs = ["workspace", *revs]
|
||||
for rev in revs:
|
||||
with switch_repo(self.repo, rev) as (repo, _):
|
||||
res: Dict = {}
|
||||
|
||||
@@ -46,7 +46,7 @@ class ThreadPoolExecutor(futures.ThreadPoolExecutor):
|
||||
if sys.version_info > (3, 9): # pylint: disable=no-else-return
|
||||
# pylint: disable=unexpected-keyword-arg
|
||||
return super().shutdown(wait=wait, cancel_futures=cancel_futures)
|
||||
else:
|
||||
else: # noqa: RET505
|
||||
with self._shutdown_lock:
|
||||
self._shutdown = True
|
||||
if cancel_futures:
|
||||
|
||||
+12
-3
@@ -79,11 +79,11 @@ lint = [
|
||||
"pylint==2.17.4",
|
||||
"types-colorama",
|
||||
"types-psutil",
|
||||
"types-pyinstaller",
|
||||
"types-requests",
|
||||
"types-tabulate",
|
||||
"types-toml",
|
||||
"types-tqdm",
|
||||
"types-pyinstaller",
|
||||
]
|
||||
oss = ["dvc-oss==2.19"]
|
||||
s3 = ["dvc-s3==2.23.0"]
|
||||
@@ -268,8 +268,16 @@ ignored-argument-names = "_.*|args|kwargs"
|
||||
[tool.ruff]
|
||||
# external flake8 codes that should be preserved
|
||||
external = ["B301", "C901", "E302", "W601"]
|
||||
ignore = ["N818", "S101", "PT004", "PT007", "PT019", "SIM105", "SIM108", "SIM110", "SIM117", "TRY003", "TRY200", "TRY300", "TRY301", "PLR2004", "PLW2901", "RUF005", "RUF012"]
|
||||
select = ["F", "E", "W", "C90", "N", "UP", "YTT", "ASYNC", "S", "BLE", "B", "A", "C4", "T10", "EXE", "ISC", "ICN", "G", "INP", "PIE", "T20", "PYI", "PT", "Q", "RSE", "RET501", "RET504", "SLOT", "SIM", "TID", "TCH", "ARG", "PGH", "PLC", "PLE", "PLR", "PLW", "TRY", "FLY", "RUF"]
|
||||
ignore = [
|
||||
"N818", "S101", "PT004", "PT007", "RET501", "RET502", "RET503", "SIM105", "SIM108",
|
||||
"SIM117", "TRY003", "TRY200", "TRY300", "PLR2004", "PLW2901", "RUF012"
|
||||
]
|
||||
select = [
|
||||
"F", "E", "W", "C90", "N", "UP", "YTT", "ASYNC", "S", "BLE", "B", "A", "C4", "T10",
|
||||
"EXE", "ISC", "ICN", "G", "INP", "PIE", "T20", "PYI", "PT", "Q", "RSE", "RET",
|
||||
"SLOT", "SIM", "TID", "TCH", "ARG", "PGH", "PLC", "PLE", "PLR", "PLW", "TRY",
|
||||
"FLY", "PERF101", "RUF",
|
||||
]
|
||||
show-source = true
|
||||
|
||||
[tool.ruff.flake8-pytest-style]
|
||||
@@ -298,6 +306,7 @@ ignore-names = ["M", "SCM"]
|
||||
"dvc/commands/**" = ["N806"]
|
||||
"dvc/testing/**" = ["ARG002"]
|
||||
"dvc/testing/benchmarks/**" = ["ARG001"]
|
||||
"tests/**" = ["S", "ARG001", "ARG002", "TRY002", "TRY301"]
|
||||
|
||||
[tool.ruff.pylint]
|
||||
max-args = 10
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
extend = "../pyproject.toml"
|
||||
extend-select = ["RUF005"]
|
||||
extend-ignore = ["S", "RUF001", "ARG001", "ARG002", "TRY002"]
|
||||
Reference in New Issue
Block a user