mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Enable map configurations (config v2).
This commit is contained in:
parent
ef8347cf2d
commit
3e76cdaf25
11 changed files with 70 additions and 52 deletions
|
|
@ -142,9 +142,13 @@ class Map(collections.namedtuple('Map', ('object_name', 'id_key', 'items'))):
|
|||
raise ValidationError('Expected a {} map but got a {}'.format(
|
||||
self.object_name, type(v).__name__,
|
||||
))
|
||||
with validate_context('At {}({}={!r})'.format(
|
||||
if self.id_key is None:
|
||||
context = 'At {}()'.format(self.object_name)
|
||||
else:
|
||||
context = 'At {}({}={!r})'.format(
|
||||
self.object_name, self.id_key, v.get(self.id_key, MISSING),
|
||||
)):
|
||||
)
|
||||
with validate_context(context):
|
||||
for item in self.items:
|
||||
item.check(v)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue