mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 10:31:46 +04:00
Allow local config only hooks
If a repo does not have a manifest, go with local repo config only.
This commit is contained in:
parent
0670e0b287
commit
ebe3e59e35
2 changed files with 41 additions and 9 deletions
|
|
@ -5,8 +5,10 @@ import shlex
|
|||
import sys
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import Mapping
|
||||
from typing import Optional
|
||||
from typing import Sequence
|
||||
from typing import TypeVar
|
||||
|
||||
import cfgv
|
||||
from identify.identify import ALL_TAGS
|
||||
|
|
@ -89,6 +91,18 @@ load_manifest = functools.partial(
|
|||
)
|
||||
|
||||
|
||||
HOOK_CONFIG_T = TypeVar('HOOK_CONFIG_T', bound=Mapping[str, Any])
|
||||
|
||||
|
||||
def validate_manifest(data: HOOK_CONFIG_T) -> HOOK_CONFIG_T:
|
||||
return cfgv.validate(data, MANIFEST_SCHEMA)
|
||||
|
||||
|
||||
def apply_manifest_defaults(data: Sequence[HOOK_CONFIG_T]) \
|
||||
-> Sequence[HOOK_CONFIG_T]:
|
||||
return cfgv.apply_defaults(data, MANIFEST_SCHEMA)
|
||||
|
||||
|
||||
def validate_manifest_main(argv: Optional[Sequence[str]] = None) -> int:
|
||||
parser = _make_argparser('Manifest filenames.')
|
||||
args = parser.parse_args(argv)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue