diff --git a/dvc/commands/destroy.py b/dvc/commands/destroy.py index 4b88683fd6..aee1de1618 100644 --- a/dvc/commands/destroy.py +++ b/dvc/commands/destroy.py @@ -21,7 +21,7 @@ def run(self): ) 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." ) diff --git a/dvc/repo/experiments/queue/tempdir.py b/dvc/repo/experiments/queue/tempdir.py index dfc724c7c7..6af965d2b2 100644 --- a/dvc/repo/experiments/queue/tempdir.py +++ b/dvc/repo/experiments/queue/tempdir.py @@ -115,7 +115,9 @@ def _reproduce_entry( 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) diff --git a/dvc/repo/experiments/queue/workspace.py b/dvc/repo/experiments/queue/workspace.py index fe21b3f66f..c9218b52f9 100644 --- a/dvc/repo/experiments/queue/workspace.py +++ b/dvc/repo/experiments/queue/workspace.py @@ -121,7 +121,9 @@ def _reproduce_entry( 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) diff --git a/dvc/repo/plots/__init__.py b/dvc/repo/plots/__init__.py index b1a9b64d52..5d1053455e 100644 --- a/dvc/repo/plots/__init__.py +++ b/dvc/repo/plots/__init__.py @@ -134,7 +134,7 @@ def collect( 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 = {} diff --git a/dvc/utils/threadpool.py b/dvc/utils/threadpool.py index 5d75c2e752..0c58e8eb7a 100644 --- a/dvc/utils/threadpool.py +++ b/dvc/utils/threadpool.py @@ -46,7 +46,7 @@ def shutdown(self, wait=True, *, cancel_futures=False): 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: diff --git a/pyproject.toml b/pyproject.toml index 12bdc42650..00b5bed02a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 diff --git a/tests/ruff.toml b/tests/ruff.toml deleted file mode 100644 index 36d358bd74..0000000000 --- a/tests/ruff.toml +++ /dev/null @@ -1,3 +0,0 @@ -extend = "../pyproject.toml" -extend-select = ["RUF005"] -extend-ignore = ["S", "RUF001", "ARG001", "ARG002", "TRY002"]