Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add "add" command #47
Add "add" command #47
Changes from 3 commits
9bf07b0
632f9af
2f34f3a
443bb21
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
A newline should be added to the end of the entry if it doesn't already have one.
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.
Should this be done by using "String.contains" and appending
"\n"
or is there other idiomatic way of doing it?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.
i don't think you meant to remove all of this.
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.
Well, if we don't remove this, it will print the unrelease thing with an empty body, without the entries that we're adding. That's why I removed it 👍
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.
Doesn't this break the "unreleased" command?
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.
The "unreleased" release should always show the fixed, added, and changed sections, even if they are empty.
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.
I suspect that this is the cause of the CI failure
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.
Yeah!
It's yielding
## [unreleased] - unreleased
and makes the test fail.I'm struggling to reach a point where I can print the empty sections only from unlreleased versions.
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.
Turns out that unreleased sections were being parsed as
None
, so I added an extra check for each section saying that if it's unreleased and the section isNone
, it will use theSection._empty(....)
for printing.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.
Also, for the parse test that's failing, a changelog must now contain all sections in "unreleased" because it can no longer assume that the "unreleased" release is either empty or nonexistent. It may be best to create a new class,
Unreleased
that usesSection
instead of(Section | None)
as field types. This would be simpler than treating it as any other release at this point.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.
@ordepdev would you want to include the changes above in this PR? If not, I can do it after this PR is merged.
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.
I would love to but I think it's better to let you do it and take a look at your changes after!
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.
Adding
.> create_unreleased()
here beforeadd_entry
will likely solve the problem. An unreleased section should be created anyway if someone is using this command.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.
Hmm, creating a new "unreleased" release creates new empty sections.
Currently, this works as expected. If I add that command only the last "changed" will be reflected in the file, right?
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.
Yeah, the problem is that the "unreleased" release must contain all sections if it exists. Previously the
string
function would assume that it is empty if it exists. But this is no longer a reasonable assumption, so the sections must be created if they don't exist. That's why it may be useful to create a new class for unreleased that reflects the requirement that the sections cannot have typeNone
.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.
Makes sense, make the types do the work instead.