-
-
Notifications
You must be signed in to change notification settings - Fork 279
Ensure At Least One Blank Line Between Old and New Changelog Content #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Upgrade self-test hook from v1.23.0 to v2.24.0. The former version crashes with the following error: ImportError: cannot import name 'soft_unicode' from 'markupsafe' Configure Commitizen to automatically bump the version of its own hook that it uses. Use the new location of the repository in the commitizen-tools org.
The existing regex had numerous bugs and boiled down to a very complex way of matching any file whatsoever in the tests directory. Correct the syntax issues, and make a best guess at the original intent.
Replace "script" with the current name of the directory, "scripts."
The original explanation has some minor grammatical errors.
- Specify what output_lines and lines are lists of, namely strings. - Remove unnecessary test of whether latest_version_position is an int since x != None for any integer x. - Replace two consecutive list.append calls with a single list.extend call.
Ensure there is at least one blank line separating old and new content. We already separate the log entries for each release with blank lines, so separate pre-existing content from the first release with a blank line as well. If the pre-existing content ends in a blank line, then don't add an extra one.
Codecov Report
@@ Coverage Diff @@
## master #511 +/- ##
==========================================
+ Coverage 97.85% 97.92% +0.06%
==========================================
Files 39 39
Lines 1539 1540 +1
==========================================
+ Hits 1506 1508 +2
+ Misses 33 32 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -3,7 +3,8 @@ version = "2.24.0" | |||
tag_format = "v$version" | |||
version_files = [ | |||
"pyproject.toml:version", | |||
"commitizen/__version__.py" | |||
"commitizen/__version__.py", | |||
".pre-commit-config.yaml:rev.\\s+(?=[^\\n]+Commitizen)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is neat!
@@ -270,16 +270,14 @@ def incremental_build(new_content: str, lines: List, metadata: Dict) -> List: | |||
if skip: | |||
continue | |||
|
|||
if ( | |||
isinstance(latest_version_position, int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering why this condition is removed
Description
Ensure there is at least one blank line separating old and new content when appending incrementally to the changelog. Log entries for each release are already separated with blank lines, so separate pre-existing content from the first release with a blank line as well. If the pre-existing content ends with a blank line, then don't add an extra one.
I also fixed some unrelated pre-existing issues with
.pre-commit-config.yaml
in order to be able to comply with the contributing guidelines.Please let me know which documentation I should update if you feel this change warrants mention. I wasn't sure whether to classify this as a tiny feature or a bug fix.
Closes #509.
Checklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testExpected behavior
If the changelog already says "This changelog is auto-generated by the Python-based
Commitizen.", then when the first release is added by Commitizen, it doesn't ram right up against the pre-existing content.
Steps to Test This Pull Request
CHANGELOG.md
, and add some content to it that doesn't end in an extra blank line (besides the one at the end of the file).cz changelog --incremental
.