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 0ed35b3

Browse files
committed
refactor(commands/commit): change valiable by comment and use black
1 parent 83e2ee7 commit 0ed35b3

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

‎commitizen/commands/commit.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ def get_event_loop(self):
2828
self.set_event_loop(self._loop_factory(selectors.SelectSelector()))
2929
return self._local._loop
3030

31+
3132
class WrapStdx:
32-
def __init__(self, stdx:IOBase):
33+
def __init__(self, stdx:IOBase):
3334
self._fileno = stdx.fileno()
34-
if sys.platform == 'linux':
35+
if sys.platform == "linux":
3536
if self._fileno == 0:
3637
fd = os.open("/dev/tty", os.O_RDWR | os.O_NOCTTY)
3738
tty = open(fd, "wb+", buffering=0)
@@ -46,7 +47,7 @@ def __init__(self, stdx:IOBase):
4647
self.tty = tty
4748

4849
def __getattr__(self, key):
49-
if key == "encoding" and (sys.platform != 'linux' or self._fileno == 0):
50+
if key == "encoding" and (sys.platform != "linux" or self._fileno == 0):
5051
return "UTF-8"
5152
return getattr(self.tty, key)
5253

@@ -104,7 +105,7 @@ def __call__(self):
104105
old_stdin = sys.stdin
105106
old_stdout = sys.stdout
106107
old_stderr = sys.stderr
107-
old_event_loop_policy=get_event_loop_policy()
108+
old_event_loop_policy=get_event_loop_policy()
108109
set_event_loop_policy(CZEventLoopPolicy())
109110
sys.stdin = WrapStdx(sys.stdin)
110111
sys.stdout = WrapStdx(sys.stdout)
@@ -135,12 +136,12 @@ def __call__(self):
135136
raise DryRunExit()
136137

137138
if commit_msg_file:
138-
defaultmesaage = ""
139+
default_mesaage = ""
139140
with open(commit_msg_file) as f:
140-
defaultmesaage = f.read()
141+
default_message = f.read()
141142
with open(commit_msg_file, "w") as f:
142143
f.write(m)
143-
f.write(defaultmesaage)
144+
f.write(default_message)
144145
out.success("Commit message is successful!")
145146
return
146147

@@ -151,7 +152,6 @@ def __call__(self):
151152
else:
152153
c = git.commit(m)
153154

154-
155155
if c.return_code != 0:
156156
out.error(c.err)
157157

‎docs/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ After the configuration is added, you'll need to run
120120
121121
```sh
122122
pre-commit install --hook-type commit-msg
123+
pre-commit install --hook-type prepare-commit-msg
123124
```
124125

125126
Read more about the `check` command [here](check.md).

0 commit comments

Comments
(0)

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