Skip to content

Commit a47628e

Browse files
authored
Merge pull request #190 from commitizen-tools/unify-docstring-style
remove trailing space in keep_a_changelog and other minor improvement
2 parents 5201aaf + 274179f commit a47628e

20 files changed

+66
-67
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ jobs:
1212
python-version: [3.6, 3.7, 3.8]
1313

1414
steps:
15-
- uses: actions/checkout@v1
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
1618
- name: Set up Python ${{ matrix.python-version }}
1719
uses: actions/setup-python@v1
1820
with:
@@ -27,6 +29,14 @@ jobs:
2729
git config --global user.email "action@github.com"
2830
git config --global user.name "GitHub Action"
2931
./scripts/test
32+
- name: Check commit
33+
run: |
34+
poetry run python -m commitizen check --rev-range ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} || \
35+
if [ $$? == 3 ] ; then
36+
exit 0;
37+
else
38+
exit 1;
39+
fi
3040
- name: Upload coverage to Codecov
3141
if: runner.os == 'Linux'
3242
uses: codecov/codecov-action@v1.0.3

commitizen/bump.py

Lines changed: 3 additions & 4 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
@@ -137,7 +138,7 @@ def update_version_in_files(
137138
So for example, your tag could look like `v1.0.0` while your version in
138139
the package like `1.0.0`.
139140
"""
140-
# TODO: sepearte check step and write step
141+
# TODO: separate check step and write step
141142
for location in files:
142143
filepath, *regexes = location.split(":", maxsplit=1)
143144
regex = regexes[0] if regexes else None
@@ -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/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
{
115115
"name": "--bump-message",
116116
"help": (
117-
"template used to create the release commmit, "
117+
"template used to create the release commit, "
118118
"useful when working with CI"
119119
),
120120
},

commitizen/commands/bump.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def __call__(self): # noqa: C901
154154
self.config.set_key("version", new_version.public)
155155
c = git.commit(message, args=self._get_commit_args())
156156
if c.err:
157-
out.error('git.commit errror: "{}"'.format(c.err.strip()))
157+
out.error('git.commit error: "{}"'.format(c.err.strip()))
158158
raise SystemExit(COMMIT_FAILED)
159159
c = git.tag(new_tag_version)
160160
if c.err:

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/config/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def load_global_conf() -> Optional[IniConfig]:
1616
if not global_cfg.exists():
1717
return None
1818

19-
# global conf doesnt make sense with commitizen bump
19+
# global conf doesn't make sense with commitizen bump
2020
# so I'm deprecating it and won't test it
2121
message = (
2222
"Global conf will be deprecated in next major version. "

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/factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def commiter_factory(config: BaseConfig) -> BaseCommitizen:
1111
_cz = registry[name](config)
1212
except KeyError:
1313
msg_error = (
14-
"The commiter has not been found in the system.\n\n"
14+
"The committer has not been found in the system.\n\n"
1515
f"Try running 'pip install {name}'\n"
1616
)
1717
out.error(msg_error)

0 commit comments

Comments
 (0)