mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Some manual .format() -> f-strings
This commit is contained in:
parent
aefbe71765
commit
9000e9dd41
27 changed files with 133 additions and 173 deletions
|
|
@ -137,8 +137,8 @@ class Hook(NamedTuple):
|
|||
extra_keys = set(dct) - set(_KEYS)
|
||||
if extra_keys:
|
||||
logger.warning(
|
||||
'Unexpected key(s) present on {} => {}: '
|
||||
'{}'.format(src, dct['id'], ', '.join(sorted(extra_keys))),
|
||||
f'Unexpected key(s) present on {src} => {dct["id"]}: '
|
||||
f'{", ".join(sorted(extra_keys))}',
|
||||
)
|
||||
return cls(src=src, prefix=prefix, **{k: dct[k] for k in _KEYS})
|
||||
|
||||
|
|
@ -154,11 +154,9 @@ def _hook(
|
|||
version = ret['minimum_pre_commit_version']
|
||||
if parse_version(version) > parse_version(C.VERSION):
|
||||
logger.error(
|
||||
'The hook `{}` requires pre-commit version {} but version {} '
|
||||
'is installed. '
|
||||
'Perhaps run `pip install --upgrade pre-commit`.'.format(
|
||||
ret['id'], version, C.VERSION,
|
||||
),
|
||||
f'The hook `{ret["id"]}` requires pre-commit version {version} '
|
||||
f'but version {C.VERSION} is installed. '
|
||||
f'Perhaps run `pip install --upgrade pre-commit`.',
|
||||
)
|
||||
exit(1)
|
||||
|
||||
|
|
@ -210,10 +208,9 @@ def _cloned_repository_hooks(
|
|||
for hook in repo_config['hooks']:
|
||||
if hook['id'] not in by_id:
|
||||
logger.error(
|
||||
'`{}` is not present in repository {}. '
|
||||
'Typo? Perhaps it is introduced in a newer version? '
|
||||
'Often `pre-commit autoupdate` fixes this.'
|
||||
.format(hook['id'], repo),
|
||||
f'`{hook["id"]}` is not present in repository {repo}. '
|
||||
f'Typo? Perhaps it is introduced in a newer version? '
|
||||
f'Often `pre-commit autoupdate` fixes this.',
|
||||
)
|
||||
exit(1)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue