From a5907b904f568d3249b7629ea9ff3b932f723ce3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 19 Jun 2022 09:00:25 +0200 Subject: Adding upstream version 2.19.0. Signed-off-by: Daniel Baumann --- pre_commit/commands/validate_config.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 pre_commit/commands/validate_config.py (limited to 'pre_commit/commands/validate_config.py') diff --git a/pre_commit/commands/validate_config.py b/pre_commit/commands/validate_config.py new file mode 100644 index 0000000..91bb017 --- /dev/null +++ b/pre_commit/commands/validate_config.py @@ -0,0 +1,16 @@ +from __future__ import annotations + +from pre_commit import clientlib + + +def validate_config(filenames: list[str]) -> int: + ret = 0 + + for filename in filenames: + try: + clientlib.load_config(filename) + except clientlib.InvalidConfigError as e: + print(e) + ret = 1 + + return ret -- cgit v1.2.3