blob: 6f3b093e70f534447143470321826c560e13be21 [file] [log] [blame]
Pieter De Gendt4db97b52024-11-07 21:09:05 +01001#!/usr/bin/env python3
2
3# Copyright (c) 2024 Basalte bv
4# SPDX-License-Identifier: Apache-2.0
5
6import sys
7
8# A very simple script to convert ruff format output to toml
9# For example:
10# ruff format --check | ./scripts/ruff/gen_format_exclude.py >> .ruff-excludes.toml
11
12if __name__ == "__main__":
13 sys.stdout.write("[format]\n")
14 sys.stdout.write("exclude = [\n")
15 for line in sys.stdin:
16 if line.startswith("Would reformat: "):
17 sys.stdout.write(f' "./{line[16:-1]}",\n')
18 sys.stdout.write("]\n")