From a54cccc012c922d7a60b837ebad688d4f46a326e Mon Sep 17 00:00:00 2001 From: PIG208 <359101898@qq.com> Date: Fri, 28 May 2021 17:06:39 +0800 Subject: [PATCH] lint: Add black as a linter. --- tools/lint | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/lint b/tools/lint index d9691c6..56c096c 100755 --- a/tools/lint +++ b/tools/lint @@ -1,6 +1,7 @@ #! /usr/bin/env python3 import argparse +import re import sys from zulint.command import LinterConfig, add_default_linter_arguments @@ -44,6 +45,15 @@ def run() -> None: description="Sorts Python import statements", check_arg=["--check-only", "--diff"], ) + linter_config.external_linter( + "black", + ["black"], + ["py"], + description="Reformats Python code", + check_arg=["--check"], + suppress_line=lambda line: line == "All done! ✨ 🍰 ✨\n" + or re.fullmatch(r"\d+ files? would be left unchanged\.\n", line) is not None, + ) @linter_config.lint def custom_py() -> int: