From cd93380190440812b21650d3bb7969887e319d50 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Tue, 22 Jul 2025 00:43:55 +0200 Subject: [PATCH] Add Ruff as a formatter It's complimented by `add-trailing-comma` for better readability and uses a double run to settle one the final format seamlessly. --- .pre-commit-config.yaml | 26 ++++++++++++++++++++++++++ .ruff.toml | 4 ++++ 2 files changed, 30 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 .ruff.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b1b576b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,26 @@ +--- + +ci: + autoupdate_schedule: quarterly # low frequency to reduce maintenance noise + +repos: +- repo: https://github.com/astral-sh/ruff-pre-commit.git + rev: v0.12.4 + hooks: + - id: ruff-format + alias: ruff-format-first-pass + name: ruff-format (first pass) + +- repo: https://github.com/asottile/add-trailing-comma.git + rev: v3.2.0 + hooks: + - id: add-trailing-comma + +- repo: https://github.com/astral-sh/ruff-pre-commit.git + rev: v0.12.4 + hooks: + - id: ruff-format + alias: ruff-format-second-pass + name: ruff-format (second pass) + +... diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 0000000..ba4cd7d --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,4 @@ +line-length = 79 # Accessibility-friendly + +[format] +quote-style = "single"