From 2c67bc572628d2b870b6f037fe3b30d8824f655b Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Fri, 10 Nov 2023 09:27:45 +0100 Subject: [PATCH] chore: drop yapf and favor of the ruff formatter (#318) --- .woodpecker/lint.yml | 2 +- gitbatch/cli.py | 2 +- gitbatch/logging.py | 4 +-- gitbatch/utils.py | 2 +- poetry.lock | 67 +------------------------------------------- pyproject.toml | 28 ++++++------------ 6 files changed, 13 insertions(+), 92 deletions(-) diff --git a/.woodpecker/lint.yml b/.woodpecker/lint.yml index 76d46a0..a47ca26 100644 --- a/.woodpecker/lint.yml +++ b/.woodpecker/lint.yml @@ -12,7 +12,7 @@ steps: - git fetch --depth=2147483647 - pip install poetry poetry-dynamic-versioning -qq - poetry install - - poetry run yapf -dr ./${CI_REPO_NAME//-/} + - poetry run ruff format --check --diff ./${CI_REPO_NAME//-/} environment: PY_COLORS: "1" diff --git a/gitbatch/cli.py b/gitbatch/cli.py index 95fda68..8f970b3 100644 --- a/gitbatch/cli.py +++ b/gitbatch/cli.py @@ -134,7 +134,7 @@ class GitBatch: path, repo["dest"], ignore=shutil.ignore_patterns(".git"), - dirs_exist_ok=self.config["ignore_existing"] + dirs_exist_ok=self.config["ignore_existing"], ) except FileExistsError: self._file_exist_handler() diff --git a/gitbatch/logging.py b/gitbatch/logging.py index 6f30027..2dada1a 100644 --- a/gitbatch/logging.py +++ b/gitbatch/logging.py @@ -93,9 +93,7 @@ class Log: handler.addFilter(LogFilter(logging.WARNING)) handler.setFormatter( MultilineFormatter( - self.warning( - CONSOLE_FORMAT.format(colorama.Fore.YELLOW, colorama.Style.RESET_ALL) - ) + self.warning(CONSOLE_FORMAT.format(colorama.Fore.YELLOW, colorama.Style.RESET_ALL)) ) ) diff --git a/gitbatch/utils.py b/gitbatch/utils.py index e54cdef..9984e30 100644 --- a/gitbatch/utils.py +++ b/gitbatch/utils.py @@ -26,7 +26,7 @@ def strtobool(value): "f": False, "false": False, "off": False, - "0": False + "0": False, } try: diff --git a/poetry.lock b/poetry.lock index b606cde..90e5751 100644 --- a/poetry.lock +++ b/poetry.lock @@ -123,25 +123,6 @@ gitdb = ">=4.0.1,<5" [package.extras] test = ["black", "coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mock", "mypy", "pre-commit", "pytest", "pytest-cov", "pytest-instafail", "pytest-subtests", "pytest-sugar"] -[[package]] -name = "importlib-metadata" -version = "6.8.0" -description = "Read metadata from Python packages" -optional = false -python-versions = ">=3.8" -files = [ - {file = "importlib_metadata-6.8.0-py3-none-any.whl", hash = "sha256:3ebb78df84a805d7698245025b975d9d67053cd94c79245ba4b3eb694abe68bb"}, - {file = "importlib_metadata-6.8.0.tar.gz", hash = "sha256:dbace7892d8c0c4ac1ad096662232f831d4e64f4c4545bd53016a3e9d4654743"}, -] - -[package.dependencies] -zipp = ">=0.5" - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -perf = ["ipython"] -testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"] - [[package]] name = "iniconfig" version = "2.0.0" @@ -164,21 +145,6 @@ files = [ {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, ] -[[package]] -name = "platformdirs" -version = "3.11.0" -description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -optional = false -python-versions = ">=3.7" -files = [ - {file = "platformdirs-3.11.0-py3-none-any.whl", hash = "sha256:e9d171d00af68be50e9202731309c4e658fd8bc76f55c11c7dd760d023bda68e"}, - {file = "platformdirs-3.11.0.tar.gz", hash = "sha256:cf8ee52a3afdb965072dcc652433e0c7e3e40cf5ea1477cd4b3b1d2eb75495b3"}, -] - -[package.extras] -docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.1)", "sphinx-autodoc-typehints (>=1.24)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)"] - [[package]] name = "pluggy" version = "1.3.0" @@ -321,38 +287,7 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] -[[package]] -name = "yapf" -version = "0.40.2" -description = "A formatter for Python code" -optional = false -python-versions = ">=3.7" -files = [ - {file = "yapf-0.40.2-py3-none-any.whl", hash = "sha256:adc8b5dd02c0143108878c499284205adb258aad6db6634e5b869e7ee2bd548b"}, - {file = "yapf-0.40.2.tar.gz", hash = "sha256:4dab8a5ed7134e26d57c1647c7483afb3f136878b579062b786c9ba16b94637b"}, -] - -[package.dependencies] -importlib-metadata = ">=6.6.0" -platformdirs = ">=3.5.1" -tomli = ">=2.0.1" - -[[package]] -name = "zipp" -version = "3.17.0" -description = "Backport of pathlib-compatible object wrapper for zip files" -optional = false -python-versions = ">=3.8" -files = [ - {file = "zipp-3.17.0-py3-none-any.whl", hash = "sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31"}, - {file = "zipp-3.17.0.tar.gz", hash = "sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0"}, -] - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy (>=0.9.1)", "pytest-ruff"] - [metadata] lock-version = "2.0" python-versions = "^3.8.0" -content-hash = "464125568867a352815fed1ff9d4d10a6356c48459f56d344b58703683da3f44" +content-hash = "2cc4664bdb5f32be1c36cfb458d78ba0137d574c28b1744c5b2642a8569f2a27" diff --git a/pyproject.toml b/pyproject.toml index 455b3f0..33bfae3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,20 +49,12 @@ pytest = "7.4.3" pytest-mock = "3.12.0" pytest-cov = "4.1.0" toml = "0.10.2" -yapf = "0.40.2" [tool.poetry-dynamic-versioning] enable = true style = "semver" vcs = "git" -[tool.isort] -default_section = "THIRDPARTY" -force_single_line = true -line_length = 99 -sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] -skip_glob = ["**/.env*", "**/env/*", "**/.venv/*", "**/docs/*"] - [tool.pytest.ini_options] addopts = "gitbatch --cov=gitbatch --cov-report=xml:coverage.xml --cov-report=term --no-cov-on-fail" filterwarnings = [ @@ -91,6 +83,10 @@ exclude = [ ".eggs", "env*", ] + +line-length = 99 +indent-width = 4 + # Explanation of errors # # D102: Missing docstring in public method @@ -111,7 +107,6 @@ ignore = [ "UP038", "RUF012", ] -line-length = 99 select = [ "D", "E", @@ -134,14 +129,7 @@ select = [ "RUF", ] -[tool.ruff.flake8-quotes] -inline-quotes = "double" - -[tool.yapf] -based_on_style = "google" -column_limit = 99 -dedent_closing_brackets = true -coalesce_brackets = true -split_before_logical_operator = true -indent_dictionary_value = true -allow_split_before_dict_value = false +[tool.ruff.format] +quote-style = "double" +indent-style = "space" +line-ending = "lf"