summaryrefslogtreecommitdiffstats
path: root/pre_commit/commands/validate_config.py
blob: b3de635b1fc20d97032269c66c2d0c85a7626d67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from __future__ import annotations

from collections.abc import Sequence

from pre_commit import clientlib


def validate_config(filenames: Sequence[str]) -> int:
    ret = 0

    for filename in filenames:
        try:
            clientlib.load_config(filename)
        except clientlib.InvalidConfigError as e:
            print(e)
            ret = 1

    return ret