mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 18:11:48 +04:00
Install local hooks in the ~/.pre-commit folder
This commit is contained in:
parent
377cffbd27
commit
9a8fb17070
15 changed files with 103 additions and 75 deletions
|
|
@ -58,7 +58,7 @@ def install_environment(
|
|||
repo_cmd_runner,
|
||||
version='default',
|
||||
additional_dependencies=(),
|
||||
is_local_hook = False,
|
||||
is_local_hook=False,
|
||||
): # pragma: windows no cover
|
||||
assert repo_cmd_runner.exists('Dockerfile'), (
|
||||
'No Dockerfile was found in the hook repository'
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ def install_environment(
|
|||
repo_cmd_runner,
|
||||
version='default',
|
||||
additional_dependencies=(),
|
||||
is_local_hook = False,
|
||||
is_local_hook=False,
|
||||
):
|
||||
helpers.assert_version_default('golang', version)
|
||||
directory = repo_cmd_runner.path(
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ def install_environment(
|
|||
repo_cmd_runner,
|
||||
version='default',
|
||||
additional_dependencies=(),
|
||||
is_local_hook = False,
|
||||
is_local_hook=False,
|
||||
): # pragma: windows no cover
|
||||
additional_dependencies = tuple(additional_dependencies)
|
||||
assert repo_cmd_runner.exists('package.json')
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ def install_environment(
|
|||
repo_cmd_runner,
|
||||
version='default',
|
||||
additional_dependencies=(),
|
||||
is_local_hook = False,
|
||||
is_local_hook=False,
|
||||
):
|
||||
"""Installation for pcre type is a noop."""
|
||||
raise AssertionError('Cannot install pcre repo.')
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ def install_environment(
|
|||
repo_cmd_runner,
|
||||
version='default',
|
||||
additional_dependencies=(),
|
||||
is_local_hook = False,
|
||||
is_local_hook=False,
|
||||
):
|
||||
additional_dependencies = tuple(additional_dependencies)
|
||||
directory = helpers.environment_dir(ENVIRONMENT_DIR, version)
|
||||
|
|
@ -74,7 +74,7 @@ def install_environment(
|
|||
else:
|
||||
venv_cmd.extend(['-p', os.path.realpath(sys.executable)])
|
||||
repo_cmd_runner.run(venv_cmd, cwd='/')
|
||||
to_install = () if is_local_hook else ('.')
|
||||
to_install = () if is_local_hook else ('.',)
|
||||
to_install += additional_dependencies
|
||||
with in_env(repo_cmd_runner, version):
|
||||
helpers.run_setup_cmd(
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ def install_environment(
|
|||
repo_cmd_runner,
|
||||
version='default',
|
||||
additional_dependencies=(),
|
||||
is_local_hook = False,
|
||||
is_local_hook=False,
|
||||
): # pragma: windows no cover
|
||||
additional_dependencies = tuple(additional_dependencies)
|
||||
directory = helpers.environment_dir(ENVIRONMENT_DIR, version)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ def install_environment(
|
|||
repo_cmd_runner,
|
||||
version='default',
|
||||
additional_dependencies=(),
|
||||
is_local_hook = False,
|
||||
is_local_hook=False,
|
||||
):
|
||||
"""Installation for script type is a noop."""
|
||||
raise AssertionError('Cannot install script repo.')
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ def install_environment(
|
|||
repo_cmd_runner,
|
||||
version='default',
|
||||
additional_dependencies=(),
|
||||
is_local_hook = False,
|
||||
is_local_hook=False,
|
||||
): # pragma: windows no cover
|
||||
helpers.assert_version_default('swift', version)
|
||||
helpers.assert_no_additional_deps('swift', additional_dependencies)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ def install_environment(
|
|||
repo_cmd_runner,
|
||||
version='default',
|
||||
additional_dependencies=(),
|
||||
is_local_hook = False,
|
||||
is_local_hook=False,
|
||||
):
|
||||
"""Installation for system type is a noop."""
|
||||
raise AssertionError('Cannot install system repo.')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue