From faa589f5540a0e6ef748a69066273f8703017660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20S=C5=82awecki?= Date: Fri, 15 Mar 2024 09:59:02 +0100 Subject: [PATCH 1/3] Bump ruff-pre-commit to v0.3.2 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8bf5890f..b25ac54a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: check-docstring-first - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.0 + rev: v0.3.2 hooks: - id: ruff - id: ruff-format From 13cabbfcea71c96cd36da8d10937de252be4e871 Mon Sep 17 00:00:00 2001 From: bswck Date: Fri, 15 Mar 2024 10:10:46 +0100 Subject: [PATCH 2/3] Add ISC001 to ignored rules --- pyproject.toml | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2535ad55..298f4907 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,27 +58,30 @@ extend-exclude = [ ] [tool.ruff.lint] +ignore = [ + "ISC001", # prevent conflicts with the formatter +] unfixable = [ - "ERA", # do not autoremove commented out code + "ERA", # do not autoremove commented out code ] extend-select = [ - "B", # flake8-bugbear - "C4", # flake8-comprehensions - "ERA", # flake8-eradicate/eradicate - "I", # isort - "N", # pep8-naming - "PIE", # flake8-pie - "PGH", # pygrep - "PTH", # flake8-use-pathlib - "ISC", # flake8-implicit-string-concat - "RET", # flake8-return - "FLY", # flynt - "PERF", # perflint - "RUF", # ruff checks - "SIM", # flake8-simplify - "TCH", # flake8-type-checking - "TID", # flake8-tidy-imports - "UP", # pyupgrade + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "ERA", # flake8-eradicate/eradicate + "I", # isort + "N", # pep8-naming + "PIE", # flake8-pie + "PGH", # pygrep + "PTH", # flake8-use-pathlib + "ISC", # flake8-implicit-string-concat + "RET", # flake8-return + "FLY", # flynt + "PERF", # perflint + "RUF", # ruff checks + "SIM", # flake8-simplify + "TCH", # flake8-type-checking + "TID", # flake8-tidy-imports + "UP", # pyupgrade ] [tool.ruff.lint.flake8-tidy-imports] From 78ea9b625df20ac488ac27e38711e74ecc731df7 Mon Sep 17 00:00:00 2001 From: bswck Date: Fri, 15 Mar 2024 10:11:19 +0100 Subject: [PATCH 3/3] Reformat files due to ruff-pre-commit upgrade --- src/cleo/ui/progress_indicator.py | 2 +- tests/ui/test_progress_bar.py | 2 +- tests/ui/test_progress_indicator.py | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cleo/ui/progress_indicator.py b/src/cleo/ui/progress_indicator.py index 927f0ddf..cddd2878 100644 --- a/src/cleo/ui/progress_indicator.py +++ b/src/cleo/ui/progress_indicator.py @@ -177,7 +177,7 @@ def _overwrite(self, message: str) -> None: Overwrites a previous message to the output. """ if self._io.is_decorated(): - self._io.write("\x0D\x1B[2K") + self._io.write("\x0d\x1b[2K") self._io.write(message) else: self._io.write_line(message) diff --git a/tests/ui/test_progress_bar.py b/tests/ui/test_progress_bar.py index db1db98a..722fb889 100644 --- a/tests/ui/test_progress_bar.py +++ b/tests/ui/test_progress_bar.py @@ -31,7 +31,7 @@ def generate_output(expected: list[str]) -> str: count = line.count("\n") if count: - output += f"\x1B[{count}A\x1B[1G\x1b[2K" + output += f"\x1b[{count}A\x1b[1G\x1b[2K" else: output += "\x1b[1G\x1b[2K" diff --git a/tests/ui/test_progress_indicator.py b/tests/ui/test_progress_indicator.py index f92545af..14a64d2d 100644 --- a/tests/ui/test_progress_indicator.py +++ b/tests/ui/test_progress_indicator.py @@ -49,19 +49,19 @@ def test_default_indicator(ansi_io: BufferedIO, sleep: Callable[[float], None]) " | Done...", ] - expected = "\x0D\x1B[2K" + "\x0D\x1B[2K".join(output) + expected = "\x0d\x1b[2K" + "\x0d\x1b[2K".join(output) expected += "\n" output = [" - Starting Again...", " \\ Starting Again...", " \\ Done Again..."] - expected += "\x0D\x1B[2K" + "\x0D\x1B[2K".join(output) + expected += "\x0d\x1b[2K" + "\x0d\x1b[2K".join(output) expected += "\n" output = [" - Starting Again...", " \\ Starting Again...", " - Done Again..."] - expected += "\x0D\x1B[2K" + "\x0D\x1B[2K".join(output) + expected += "\x0d\x1b[2K" + "\x0d\x1b[2K".join(output) expected += "\n" @@ -106,19 +106,19 @@ def test_explicit_format(ansi_io: BufferedIO, sleep: Callable[[float], None]) -> " | Done...", ] - expected = "\x0D\x1B[2K" + "\x0D\x1B[2K".join(output) + expected = "\x0d\x1b[2K" + "\x0d\x1b[2K".join(output) expected += "\n" output = [" - Starting Again...", " \\ Starting Again...", " \\ Done Again..."] - expected += "\x0D\x1B[2K" + "\x0D\x1B[2K".join(output) + expected += "\x0d\x1b[2K" + "\x0d\x1b[2K".join(output) expected += "\n" output = [" - Starting Again...", " \\ Starting Again...", " - Done Again..."] - expected += "\x0D\x1B[2K" + "\x0D\x1B[2K".join(output) + expected += "\x0d\x1b[2K" + "\x0d\x1b[2K".join(output) expected += "\n"