Skip to content
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

fix: More robust version check #104

Merged
merged 4 commits into from
Jun 13, 2023

Conversation

M123-dev
Copy link
Contributor


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.

@kevmoo
Copy link
Member

kevmoo commented May 25, 2023

"combust" version check? 😄

@kevmoo kevmoo requested a review from devoncarew May 25, 2023 16:09
Copy link
Member

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! I have feedback on the PR as in-line comments.

@@ -130,7 +130,7 @@ Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automati
print('changelog:');
print(package.changelog.describeLatestChanges.trimRight());

if (pubspecVersion != changelogVersion) {
if (!changelogVersion.toString().contains(pubspecVersion)) {
Copy link
Member

@devoncarew devoncarew May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will allow correct changes (1.2.3 and [1.2.3](...)) but will also allow incorrect ones (foo 1.2.3 bar).

We should be more precise w/ this check. I think that either means updating Changelog.latestVersion to handle the two supported types of version formats, or changing Changelog.latestVersion to be named Changelog.lastHeader and having code which can understand that as either a version or a linked version.

We should also have a test of the code that can parse [1.2.3](...) => 1.2.3.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, I can add some test, but regarding the way to extract the number. Why would foo 1.2.3 bar wrong? Some repos meight use Version: 1.2.3 [date] or something similar as header.

The only way this contains could go wrong is this dates. When the version is 26.5.2023.

I'd recommend adding a regex match [0-9]+.[0-9]+.[0-9]+ as Changelog.latestVersion.
We could allow to change from the yaml it but I don't think that is neccesary.
What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would foo 1.2.3 bar wrong? Some repos meight use Version: 1.2.3 [date] or something similar as header.

I think I'd prefer to be proscriptive here - there's no hard format for a changelog; I'd just like to support a few clear, simple formats.

If you think you can pull the version out w/ a regex reliably (and have a few positive and negative tests to show that), sgtm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've switched to using regex and added a lot of test cases, please let me know if that is what you had in mind

@devoncarew devoncarew added status-needs-info needs-info Additional information needed from the issue author and removed status-needs-info labels May 25, 2023
@M123-dev
Copy link
Contributor Author

"combust" version check? 😄

Ohhh, I was in a meeting while commiting should of course be "robust" don't know what hit me there 😆

@M123-dev M123-dev changed the title fix: More combust version check fix: More robust version check May 26, 2023
@github-actions github-actions bot removed the needs-info Additional information needed from the issue author label May 26, 2023
Reverted logic in firehose.dart
Updated latestVersion
Added a new latestHeading method
Added lots of test cases
Copy link
Member

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the impl and tests! Looks good w/ the indicated changes.

If you bump the pubspec version and add a changelog entry (for 0.3.16) we can publish it, or I can follow up after this PR lands.

pkgs/firehose/lib/src/changelog.dart Outdated Show resolved Hide resolved
pkgs/firehose/lib/src/changelog.dart Outdated Show resolved Hide resolved
pkgs/firehose/test/changelog_test.dart Outdated Show resolved Hide resolved
pkgs/firehose/test/changelog_test.dart Outdated Show resolved Hide resolved
pkgs/firehose/test/changelog_test.dart Outdated Show resolved Hide resolved
@M123-dev
Copy link
Contributor Author

M123-dev commented Jun 8, 2023

Thanks a lot @devoncarew, I've applied your comments and bumped the version.

Copy link
Member

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@devoncarew devoncarew merged commit a2dac18 into dart-lang:main Jun 13, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Smarter changelog version extraction
3 participants