-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle commit message starting with # (#59)
- Removed comments only on `--file` (since the commit message from hash doesn't contain comments). This improves performance. - Displayed full commit on 'Input' section of output. - Created function `remove_diff_from_commit_message` for removing diff from the commits. - Updated README doc for not using commit messages that start with '#'. - Allowed codecov checks for coverage.
- Loading branch information
Showing
9 changed files
with
118 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/test_linter/test_utils/test_remove_diff_from_commit_message.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# type: ignore | ||
# pylint: disable=all | ||
|
||
from commitlint.linter.utils import remove_diff_from_commit_message | ||
|
||
|
||
def test__remove_diff_from_commit_message__without_diff(): | ||
input_msg = "Commit message without diff" | ||
expected_output = "Commit message without diff" | ||
result = remove_diff_from_commit_message(input_msg) | ||
assert result == expected_output | ||
|
||
|
||
def test__remove_diff_from_commit_message__with_diff(): | ||
input_msg = ( | ||
"Fix a bug\n" | ||
"# ------------------------ >8 ------------------------\n" | ||
"Diff message" | ||
) | ||
expected_output = "Fix a bug" | ||
result = remove_diff_from_commit_message(input_msg) | ||
assert result == expected_output | ||
|
||
|
||
def test__remove_diff_from_commit_message__strips_commit_message(): | ||
input_msg = "Commit message\n " | ||
expected_output = "Commit message" | ||
result = remove_diff_from_commit_message(input_msg) | ||
assert result == expected_output |