Skip to content

Commit e26480c

Browse files
committed
lint: Add Black as a linter.
1 parent c5da18d commit e26480c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tools/lint

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#! /usr/bin/env python3
22

33
import argparse
4+
import re
45
import sys
56

67
from zulint.command import LinterConfig, add_default_linter_arguments
@@ -44,6 +45,15 @@ def run() -> None:
4445
description="Sorts Python import statements",
4546
check_arg=["--check-only", "--diff"],
4647
)
48+
linter_config.external_linter(
49+
"black",
50+
["black"],
51+
["py"],
52+
description="Reformats Python code",
53+
check_arg=["--check"],
54+
suppress_line=lambda line: line == "All done! ✨ 🍰 ✨\n"
55+
or re.fullmatch(r"\d+ files? would be left unchanged\.\n", line) is not None,
56+
)
4757

4858
@linter_config.lint
4959
def custom_py() -> int:

0 commit comments

Comments
 (0)