Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Draft
bearomorphism wants to merge1 commit intocommitizen-tools:master
base:master
Choose a base branch
Loading
frombearomorphism:refactor-getmetadata

Conversation

@bearomorphism
Copy link
Collaborator

… readability and better type

Description

Checklist

Code Changes

  • Add test cases to all the changes you introduce
  • Runpoetry all locally to ensure this change passes linter check and tests
  • Manually test the changes:
    • Verify the feature/bug fix works as expected in real-world scenarios
    • Test edge cases and error conditions
    • Ensure backward compatibility is maintained
    • Document any manual testing steps performed
  • Update the documentation for the changes

Documentation Changes

  • Runpoetry doc locally to ensure the documentation pages renders correctly
  • Check and fix any broken links (internal or external) in the documentation

When runningpoetry doc, any broken internal documentation links will be reported in the console output like this:

INFO    -  Doc file 'config.md' contains a link 'commands/bump.md#-post_bump_hooks', but the doc 'commands/bump.md' does not contain an anchor '#-post_bump_hooks'.

Expected Behavior

Steps to Test This Pull Request

Additional Context

unreleased=self.parse_title_level(line)
lines=file.readlines()
forindex,lineinenumerate(line.strip().lower()forlineinlines):
parsed_unreleased_level=self.parse_title_level(line)
Copy link
CollaboratorAuthor

@bearomorphismbearomorphismSep 12, 2025
edited
Loading

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.

Copy link
Member

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.

Copy link
Member

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
Copy link
CollaboratorAuthor

@bearomorphismbearomorphismSep 12, 2025
edited
Loading

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

@codecov
Copy link

codecovbot commentedSep 12, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.25%. Comparing base (120d514) to head (edf22a8).
⚠️ Report is 808 commits behind head on master.

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
FlagCoverage Δ
unittests98.25% <100.00%> (+0.91%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Lee-WLee-W added this to the4.9.2 milestoneSep 12, 2025
@Lee-WLee-W changed the titlerefactor(ChangelogFormat): refactor get_metadata_from_file for better…refactor(ChangelogFormat): refactor get_metadata_from_file for better readability and typeNov 8, 2025
unreleased=self.parse_title_level(line)
lines=file.readlines()
forindex,lineinenumerate(line.strip().lower()forlineinlines):
parsed_unreleased_level=self.parse_title_level(line)
Copy link
Member

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()]
Copy link
Member

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?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@Lee-WLee-WLee-W left review comments

@woilewoileAwaiting requested review from woilewoile is a code owner

@noirbizarrenoirbizarreAwaiting requested review from noirbizarrenoirbizarre is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Projects

None yet

Milestone

4.10.1

Development

Successfully merging this pull request may close these issues.

2 participants

@bearomorphism@Lee-W

[8]ページ先頭

©2009-2025 Movatter.jp