Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions cz_openwisp.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def schema_pattern(self) -> str:
# Body is optional (.* allows empty) and there's no second blank line required
regular_pattern = (
r"\[[a-z0-9!/:-]+\] [A-Z][^\n]*( #(?P<issue>\d+))?"
r"$(\n\n(.*\n)?Fixes #(?P=issue)\n?)?"
r"$(\n\n(.*\n)?(?:Close|Closes|Closed|Fix|Fixes|Fixed"
r"|Resolve|Resolves|Resolved|Related to) #(?P=issue)\n?)?"
)
return rf"(?sm)^(?:{merge_pattern}|{regular_pattern})\Z"

Expand All @@ -167,3 +168,6 @@ def info(self) -> str:
f"Allowed commit prefixes:\n\n{prefixes_list}\n\n"
"If in doubt, use chores."
)


__all__ = ["OpenWispCommitizen"]
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,28 @@ def test_valid_commit_without_body():
assert code == 0


def test_valid_commit_message_with_closes():
# GitHub also accepts "Closes" keyword to close issues
message = (
"[feature:qa] Standardized commit messages #110\n\n"
"Commitizen has been integrated.\n\n"
"Closes #110"
)
code, out, err = run_cz_check(message)
assert code == 0


def test_valid_commit_message_with_related_to():
# "Related to" is used to reference issues without closing them
message = (
"[feature] Progress on feature #110\n\n"
"Partial implementation.\n\n"
"Related to #110"
)
code, out, err = run_cz_check(message)
assert code == 0


def test_merge_commits_ignored():
message = "Merge branch 'master' into issues/110-commit-convention-standardization"
code, out, err = run_cz_check(message)
Expand Down
1 change: 0 additions & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
pytest_exit_code = pytest.main(
[
"openwisp_utils/releaser/tests",
"openwisp_utils/commitizen/tests.py",
]
)
sys.exit(pytest_exit_code)
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
platforms=["Platform Independent"],
keywords=["django", "netjson", "openwrt", "networking", "openwisp"],
packages=find_packages(exclude=["tests*", "docs*"]),
py_modules=["cz_openwisp"],
include_package_data=True,
entry_points={
"console_scripts": [
"checkmigrations = openwisp_utils.qa:check_migration_name",
"checkcommit = openwisp_utils.qa:check_commit_message",
],
"commitizen.plugin": [
"openwisp = cz_openwisp:OpenWispCommitizen",
"openwisp = openwisp_utils.releaser.commitizen:OpenWispCommitizen",
],
},
include_package_data=True,
scripts=["openwisp-qa-check", "openwisp-qa-format", "openwisp-pre-push-hook"],
zip_safe=False,
install_requires=[
Expand Down
Loading