From e87f31886a33033b2afec2594305b184a8f839ae Mon Sep 17 00:00:00 2001 From: Giuseppe Franco Date: Tue, 28 Mar 2023 08:13:42 +0000 Subject: [PATCH] Refactor (formatter): add support for yapf --- .pre-commit-config.yaml | 8 ++++++++ pyproject.toml | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ec5556364..e263eb521 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,3 +29,11 @@ repos: hooks: - id: isort name: isort (python) + + +- repo: https://github.com/pre-commit/mirrors-yapf + rev: v0.32.0 # Use the sha / tag you want to point at + hooks: + - id: yapf + args: ["-i"] + additional_dependencies: [toml] diff --git a/pyproject.toml b/pyproject.toml index 16e59d24a..b6c5c780f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,15 @@ [tool.isort] profile = "google" line_length = 100 + +[tool.yapf] +based_on_style= "google" +column_limit = 100 +SPLIT_BEFORE_DICT_SET_GENERATOR = false +SPLIT_BEFORE_CLOSING_BRACKET = false +BLANK_LINE_BEFORE_MODULE_DOCSTRING = true +SPACES_AROUND_POWER_OPERATOR = true +SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES = true +SPLIT_BEFORE_FIRST_ARGUMENT = true +SPLIT_BEFORE_DOT = true +COALESCE_BRACKETS = true