Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

bearomorphism
Copy link
Contributor

@bearomorphism bearomorphism commented Sep 11, 2025

Description

Try to address confusing variable names and function names, also reduced the number of function parameters for better readability.

Relate #1580

Better test coverage for update_version_in_file:

  • Covered return value
  • Covered check_consistency=True
  • Covered other encoding values

Checklist

Code Changes

  • Add test cases to all the changes you introduce
  • Run poetry 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

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

When running poetry 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

@@ -75,36 +75,46 @@ def update_version_in_files(

Returns the list of updated files.
"""
# TODO: separate check step and write step
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 believe this TODO is already addressed

Copy link
Contributor Author

@bearomorphism bearomorphism Sep 12, 2025

Choose a reason for hiding this comment

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

@Lee-W you left this TODO according to the git history, could you help to confirm this? Thanks.

Copy link

codecov bot commented Sep 11, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1594      +/-   ##
==========================================
+ Coverage   97.33%   98.24%   +0.91%     
==========================================
  Files          42       58      +16     
  Lines        2104     2685     +581     
==========================================
+ Hits         2048     2638     +590     
+ Misses         56       47       -9     
Flag Coverage Δ
unittests 98.24% <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.

)

# Write the file out again
with smart_open(path, "w", encoding=encoding) as file:
file.write(version_file)
file.write(bumped_version_file_content)
updated.append(path)
return updated
Copy link
Contributor Author

@bearomorphism bearomorphism Sep 11, 2025

Choose a reason for hiding this comment

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

btw the return value is not covered in the unit tests for this function. I'm not sure if it's covered anywhere else.

@Lee-W Lee-W added this to the 4.9.2 milestone Sep 11, 2025
return sorted(out)


def _bump_with_regex(
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 believe we don't need this extra layer of abstraction.

@bearomorphism bearomorphism force-pushed the fix-regex branch 2 times, most recently from 7e0a521 to 6ede88e Compare September 12, 2025 07:54
Comment on lines -67 to +68
check_consistency: bool = False,
encoding: str = ENCODING,
check_consistency: bool,
encoding: str,
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 believe we don't need this default argument. These only introduce unnecessary complexity.

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.

2 participants