From 60c2db0992d9cec77f142e9e1667f97230fd9312 Mon Sep 17 00:00:00 2001 From: Ivan Yordanov Date: Wed, 22 Nov 2023 15:44:08 +0200 Subject: [PATCH] Add toml formatter to dprint (#386) Co-authored-by: Ramin Gharib --- .github/workflows/ci.yaml | 2 +- .pre-commit-config.yaml | 2 +- docs/docs/developer/contributing.md | 4 ++++ dprint.json | 7 +++++-- pyproject.toml | 10 +++++----- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 07338b2dd..810381a09 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,7 +70,7 @@ jobs: - name: Install docs dependencies run: poetry install --with docs - - name: Check markdown formatting + - name: Check markdown, toml formatting uses: dprint/check@v2.2 if: runner.os == 'Linux' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 457a712b1..407f7830e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -68,7 +68,7 @@ repos: )$ require_serial: true - id: dprint - name: dprint + name: dprint entry: dprint fmt language: system types: [markdown] diff --git a/docs/docs/developer/contributing.md b/docs/docs/developer/contributing.md index ff55361cc..5eb775e94 100644 --- a/docs/docs/developer/contributing.md +++ b/docs/docs/developer/contributing.md @@ -17,3 +17,7 @@ Our configuration can be found in [KPOps](https://github.com/bakdata/kpops)' top ### Markdown To ensure a consistent markdown style, we use [dprint](https://dprint.dev)'s [Markdown code formatter](https://dprint.dev/plugins/markdown/). Our configuration can be found [here](https://github.com/bakdata/kpops/blob/main/dprint.json). + +### TOML + +To ensure a consistent TOML style, we use [dprint](https://dprint.dev)'s [TOML code formatter](https://dprint.dev/plugins/toml/). Our configuration can be found [here](https://github.com/bakdata/kpops/blob/main/dprint.json). diff --git a/dprint.json b/dprint.json index d702f9ea9..296f5b2f9 100644 --- a/dprint.json +++ b/dprint.json @@ -2,8 +2,10 @@ "$schema": "https://dprint.dev/schemas/v0.json", "incremental": true, "markdown": {}, + "toml": {}, "includes": [ - "**/*.{md}" + "**/*.{md}", + "**/*.{toml}" ], "excludes": [ ".pytest_cache/**", @@ -15,6 +17,7 @@ "**/config_env_vars.md" ], "plugins": [ - "https://plugins.dprint.dev/markdown-0.16.0.wasm" + "https://plugins.dprint.dev/markdown-0.16.0.wasm", + "https://plugins.dprint.dev/toml-0.5.4.wasm" ] } diff --git a/pyproject.toml b/pyproject.toml index f07648ca0..8e749efe0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,7 +67,7 @@ mike = "^1.1.2" [tool.ruff] ignore = [ -# Rules in conflict with `ruff-format` -- START + # Rules in conflict with `ruff-format` -- START "W191", # Checks for indentation that uses tabs. Spaces are preferred. # "E111", # Checks for indentation with a non-multiple of 4 spaces, add when out of nursery # "E114", # Checks for indentation of comments with a non-multiple of 4 spaces, add when out of nursery @@ -83,11 +83,11 @@ ignore = [ "COM819", # Checks for the presence of prohibited trailing commas. "ISC001", # Checks for implicitly concatenated strings on a single line. "ISC002", # Checks for implicitly concatenated strings that span multiple lines. -# Rules in conflict with `ruff-format` -- END + # Rules in conflict with `ruff-format` -- END "D1", # Missing docstring for {} -- Inconvenient to enforce -# The following "D" rules do not correspond to our coding style. We use the pep257 convention, but -# "D212" should not be ignored. In ruff (0.0.291) we cannot select a rule that is excluded by specifying -# a convention, hence our only option is to manually replicate it. + # The following "D" rules do not correspond to our coding style. We use the pep257 convention, but + # "D212" should not be ignored. In ruff (0.0.291) we cannot select a rule that is excluded by specifying + # a convention, hence our only option is to manually replicate it. "D203", # 1 blank line required before class docstring "D213", # Multi-line docstring summary should start at the second line "D214", # Section is over-indented ("{name}")