mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
parent
26e60fa333
commit
b81c9802ae
28 changed files with 58 additions and 58 deletions
|
|
@ -61,7 +61,7 @@ def _update_repository(repo_config, runner):
|
|||
if hooks_missing:
|
||||
raise RepositoryCannotBeUpdatedError(
|
||||
'Cannot update because the tip of master is missing these hooks:\n'
|
||||
'{0}'.format(', '.join(sorted(hooks_missing)))
|
||||
'{}'.format(', '.join(sorted(hooks_missing)))
|
||||
)
|
||||
|
||||
return new_config
|
||||
|
|
@ -86,7 +86,7 @@ def autoupdate(runner):
|
|||
if is_local_hooks(repo_config):
|
||||
output_configs.append(repo_config)
|
||||
continue
|
||||
sys.stdout.write('Updating {0}...'.format(repo_config['repo']))
|
||||
sys.stdout.write('Updating {}...'.format(repo_config['repo']))
|
||||
sys.stdout.flush()
|
||||
try:
|
||||
new_repo_config = _update_repository(repo_config, runner)
|
||||
|
|
@ -99,7 +99,7 @@ def autoupdate(runner):
|
|||
if new_repo_config['sha'] != repo_config['sha']:
|
||||
changed = True
|
||||
print(
|
||||
'updating {0} -> {1}.'.format(
|
||||
'updating {} -> {}.'.format(
|
||||
repo_config['sha'], new_repo_config['sha'],
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ from pre_commit.util import rmtree
|
|||
def clean(runner):
|
||||
if os.path.exists(runner.store.directory):
|
||||
rmtree(runner.store.directory)
|
||||
print('Cleaned {0}.'.format(runner.store.directory))
|
||||
print('Cleaned {}.'.format(runner.store.directory))
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ def install(runner, overwrite=False, hooks=False, hook_type='pre-commit'):
|
|||
os.remove(legacy_path)
|
||||
elif os.path.exists(legacy_path):
|
||||
print(
|
||||
'Running in migration mode with existing hooks at {0}\n'
|
||||
'Running in migration mode with existing hooks at {}\n'
|
||||
'Use -f to use only pre-commit.'.format(
|
||||
legacy_path,
|
||||
)
|
||||
|
|
@ -83,7 +83,7 @@ def install(runner, overwrite=False, hooks=False, hook_type='pre-commit'):
|
|||
pre_commit_file_obj.write(contents)
|
||||
make_executable(hook_path)
|
||||
|
||||
print('pre-commit installed at {0}'.format(hook_path))
|
||||
print('pre-commit installed at {}'.format(hook_path))
|
||||
|
||||
# If they requested we install all of the hooks, do so.
|
||||
if hooks:
|
||||
|
|
@ -110,10 +110,10 @@ def uninstall(runner, hook_type='pre-commit'):
|
|||
return 0
|
||||
|
||||
os.remove(hook_path)
|
||||
print('{0} uninstalled'.format(hook_type))
|
||||
print('{} uninstalled'.format(hook_type))
|
||||
|
||||
if os.path.exists(legacy_path):
|
||||
os.rename(legacy_path, hook_path)
|
||||
print('Restored previous hooks to {0}'.format(hook_path))
|
||||
print('Restored previous hooks to {}'.format(hook_path))
|
||||
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ def _get_skips(environ):
|
|||
|
||||
|
||||
def _hook_msg_start(hook, verbose):
|
||||
return '{0}{1}'.format(
|
||||
'[{0}] '.format(hook['id']) if verbose else '',
|
||||
return '{}{}'.format(
|
||||
'[{}] '.format(hook['id']) if verbose else '',
|
||||
hook['name'],
|
||||
)
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ def _print_user_skipped(hook, write, args):
|
|||
|
||||
def get_changed_files(new, old):
|
||||
return cmd_output(
|
||||
'git', 'diff', '--name-only', '{0}...{1}'.format(old, new),
|
||||
'git', 'diff', '--name-only', '{}...{}'.format(old, new),
|
||||
)[1].splitlines()
|
||||
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ def _run_single_hook(hook, repo, args, write, skips=frozenset()):
|
|||
write(color.format_color(pass_fail, print_color, args.color) + '\n')
|
||||
|
||||
if (stdout or stderr or file_modifications) and (retcode or args.verbose):
|
||||
write('hookid: {0}\n'.format(hook['id']))
|
||||
write('hookid: {}\n'.format(hook['id']))
|
||||
write('\n')
|
||||
|
||||
# Print a message if failing due to file modifications
|
||||
|
|
@ -200,7 +200,7 @@ def run(runner, args, write=sys_stdout_write_wrapper, environ=os.environ):
|
|||
if hook['id'] == args.hook
|
||||
]
|
||||
if not repo_hooks:
|
||||
write('No hook with id `{0}`\n'.format(args.hook))
|
||||
write('No hook with id `{}`\n'.format(args.hook))
|
||||
return 1
|
||||
|
||||
# Filter hooks for stages
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue