Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork304
refactor(ChangelogFormat): refactor get_metadata_from_file for better readability and type#1596
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| unreleased=self.parse_title_level(line) | ||
| lines=file.readlines() | ||
| forindex,lineinenumerate(line.strip().lower()forlineinlines): | ||
| parsed_unreleased_level=self.parse_title_level(line) |
bearomorphismSep 12, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 think we can assume thatself.parse_title_level is always a pure function? Then we don't have to call it twice here.
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.
If we want to make this assumption, we'll need to make this a static method instead, which makes sense but could be seen as a breaking change.
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.
but making that a static method is a good idea
| out_metadata.latest_version_position=index | ||
| break# there's no need for more info | ||
| ifmeta.unreleased_startisnotNoneandmeta.unreleased_endisNone: | ||
| meta.unreleased_end=index |
bearomorphismSep 12, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Thisindex is unbounded if the file is empty, although this never happens for all code paths
2bdf3cf to54e4288Comparecodecovbot commentedSep 12, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## master #1596 +/- ##==========================================+ Coverage 97.33% 98.25% +0.91%========================================== Files 42 58 +16 Lines 2104 2692 +588 ==========================================+ Hits 2048 2645 +597+ Misses 56 47 -9
Flags with carried forward coverage won't be shown.Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… readability and better type
54e4288 toedf22a8Compare| unreleased=self.parse_title_level(line) | ||
| lines=file.readlines() | ||
| forindex,lineinenumerate(line.strip().lower()forlineinlines): | ||
| parsed_unreleased_level=self.parse_title_level(line) |
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.
If we want to make this assumption, we'll need to make this a static method instead, which makes sense but could be seen as a breaking change.
| unreleased:int|None=None | ||
| if"unreleased"inline: | ||
| unreleased=self.parse_title_level(line) | ||
| lines= [line.strip().lower()forlineinfile.readlines()] |
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.
loop through it twice, probably not worth it?
… readability and better type
Description
Checklist
Code Changes
poetry alllocally to ensure this change passes linter check and testsDocumentation Changes
poetry doclocally to ensure the documentation pages renders correctlyExpected Behavior
Steps to Test This Pull Request
Additional Context