mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #1735 from pre-commit/allow_ci_key
allow configuration for pre-commit.ci
This commit is contained in:
commit
8670d0b3bc
2 changed files with 18 additions and 0 deletions
|
|
@ -297,9 +297,13 @@ CONFIG_SCHEMA = cfgv.Map(
|
||||||
'exclude',
|
'exclude',
|
||||||
'fail_fast',
|
'fail_fast',
|
||||||
'minimum_pre_commit_version',
|
'minimum_pre_commit_version',
|
||||||
|
'ci',
|
||||||
),
|
),
|
||||||
warn_unknown_keys_root,
|
warn_unknown_keys_root,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
# do not warn about configuration for pre-commit.ci
|
||||||
|
cfgv.OptionalNoDefault('ci', cfgv.check_type(dict)),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,20 @@ def test_validate_warn_on_unknown_keys_at_top_level(tmpdir, caplog):
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def test_ci_map_key_allowed_at_top_level(caplog):
|
||||||
|
cfg = {
|
||||||
|
'ci': {'skip': ['foo']},
|
||||||
|
'repos': [{'repo': 'meta', 'hooks': [{'id': 'identity'}]}],
|
||||||
|
}
|
||||||
|
cfgv.validate(cfg, CONFIG_SCHEMA)
|
||||||
|
assert not caplog.record_tuples
|
||||||
|
|
||||||
|
|
||||||
|
def test_ci_key_must_be_map():
|
||||||
|
with pytest.raises(cfgv.ValidationError):
|
||||||
|
cfgv.validate({'ci': 'invalid', 'repos': []}, CONFIG_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
def test_validate_optional_sensible_regex(caplog):
|
def test_validate_optional_sensible_regex(caplog):
|
||||||
config_obj = {
|
config_obj = {
|
||||||
'id': 'flake8',
|
'id': 'flake8',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue