Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a1e0383

Browse files
BogayLee-W
authored andcommitted
fix(init): space between --hook-type options
there should be a space between `--hook-type` options in generated `pre-commit` command string.
1 parent 935be91 commit a1e0383

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎commitizen/commands/init.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def _gen_pre_commit_cmd(self, hook_types: List[str]) -> str:
140140
"""Generate pre-commit command according to given hook types"""
141141
if not hook_types:
142142
raise ValueError("At least 1 hook type should be provided.")
143-
cmd_str = "pre-commit install " + "".join(
143+
cmd_str = "pre-commit install " + "".join(
144144
f"--hook-type {ty}" for ty in hook_types
145145
)
146146
return cmd_str

‎tests/commands/test_init_command.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ def test_init_without_choosing_tag(config, mocker: MockFixture, tmpdir):
9999
commands.Init(config)()
100100

101101

102+
def test_executed_pre_commit_command(config):
103+
init = commands.Init(config)
104+
expected_cmd = "pre-commit install --hook-type commit-msg --hook-type pre-push"
105+
assert init._gen_pre_commit_cmd(["commit-msg", "pre-push"]) == expected_cmd
106+
107+
102108
@pytest.fixture(scope="function")
103109
def pre_commit_installed(mocker: MockFixture):
104110
# Assume the `pre-commit` is installed

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /