Skip to content

Commit b4e2a58

Browse files
committed
style(docstring): unify docstring style
1 parent 546c442 commit b4e2a58

File tree

6 files changed

+20
-34
lines changed

6 files changed

+20
-34
lines changed

commitizen/bump.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def find_increment(
5555

5656

5757
def prerelease_generator(current_version: str, prerelease: Optional[str] = None) -> str:
58-
"""
58+
"""Generate prerelease
59+
5960
X.YaN # Alpha release
6061
X.YbN # Beta release
6162
X.YrcN # Release Candidate
@@ -179,13 +180,11 @@ def create_tag(version: Union[Version, str], tag_format: Optional[str] = None):
179180
That's why this function exists.
180181
181182
Example:
182-
183183
| tag | version (PEP 0440) |
184184
| --- | ------- |
185185
| v0.9.0 | 0.9.0 |
186186
| ver1.0.0 | 1.0.0 |
187187
| ver1.0.0.a0 | 1.0.0a0 |
188-
189188
"""
190189
if isinstance(version, str):
191190
version = Version(version)

commitizen/changelog.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
# DESIGN
1+
"""Design
32
43
## Metadata CHANGELOG.md
54
@@ -62,7 +61,6 @@ def transform_change_type(change_type: str) -> str:
6261

6362

6463
def get_commit_tag(commit: GitCommit, tags: List[GitTag]) -> Optional[GitTag]:
65-
""""""
6664
return next((tag for tag in tags if tag.rev == commit.rev), None)
6765

6866

@@ -211,13 +209,13 @@ def incremental_build(new_content: str, lines: List, metadata: Dict) -> List:
211209
The metadata holds information enough to remove the old unreleased and
212210
where to place the new content
213211
214-
Arguments:
215-
lines -- the lines from the changelog
216-
new_content -- this should be placed somewhere in the lines
217-
metadata -- information about the changelog
212+
Args:
213+
lines: The lines from the changelog
214+
new_content: This should be placed somewhere in the lines
215+
metadata: Information about the changelog
218216
219217
Returns:
220-
List -- updated lines
218+
Updated lines
221219
"""
222220
unreleased_start = metadata.get("unreleased_start")
223221
unreleased_end = metadata.get("unreleased_end")

commitizen/changelog_parser.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
# DESIGN
1+
"""CHNAGLOG PARSER DESIGN
32
43
## Parse CHANGELOG.md
54
@@ -36,8 +35,7 @@
3635

3736

3837
def find_version_blocks(filepath: str) -> Generator:
39-
"""
40-
version block: contains all the information about a version.
38+
"""Find version block (version block: contains all the information about a version.)
4139
4240
E.g:
4341
```

commitizen/commands/check.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,12 @@ class Check:
1212
"""Check if the current commit msg matches the commitizen format."""
1313

1414
def __init__(self, config: BaseConfig, arguments: Dict[str, str], cwd=os.getcwd()):
15-
"""Init method.
16-
17-
Parameters
18-
----------
19-
config : BaseConfig
20-
the config object required for the command to perform its action
21-
arguments : dict
22-
the arguments object that contains all
23-
the flags provided by the user
15+
"""Initial check command.
2416
17+
Args:
18+
config: The config object required for the command to perform its action
19+
arguments: All the flags provided by the user
20+
cwd: Current work directory
2521
"""
2622
self.commit_msg_file: Optional[str] = arguments.get("commit_msg_file")
2723
self.rev_range: Optional[str] = arguments.get("rev_range")
@@ -44,11 +40,8 @@ def _valid_command_argument(self):
4440
def __call__(self):
4541
"""Validate if commit messages follows the conventional pattern.
4642
47-
Raises
48-
------
49-
SystemExit
50-
if the commit provided not follows the conventional pattern
51-
43+
Raises:
44+
SystemExit: if the commit provided not follows the conventional pattern
5245
"""
5346
commit_msgs = self._get_commit_messages()
5447
if not commit_msgs:

commitizen/cz/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def schema(self) -> Optional[str]:
6969
raise NotImplementedError("Not Implemented yet")
7070

7171
def schema_pattern(self) -> Optional[str]:
72-
"""Regex matching the schema used for message validation"""
72+
"""Regex matching the schema used for message validation."""
7373
raise NotImplementedError("Not Implemented yet")
7474

7575
def info(self) -> Optional[str]:

commitizen/git.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ def get_commits(
6363
delimiter: str = "----------commit-delimiter----------",
6464
args: str = "",
6565
) -> List[GitCommit]:
66-
"""
67-
Get the commits betweeen start and end
68-
"""
66+
"""Get the commits betweeen start and end."""
6967
git_log_cmd = f"git log --pretty={log_format}{delimiter} {args}"
7068

7169
if start:
@@ -133,7 +131,7 @@ def find_git_project_root() -> Optional[Path]:
133131

134132

135133
def is_staging_clean() -> bool:
136-
"""Check if staing is clean"""
134+
"""Check if staing is clean."""
137135
c = cmd.run("git diff --no-ext-diff --name-only")
138136
c_cached = cmd.run("git diff --no-ext-diff --cached --name-only")
139137
return not (bool(c.out) or bool(c_cached.out))

0 commit comments

Comments
 (0)