Skip to content

refactor(git,init): code cleanup #1417

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bearomorphism
Copy link
Contributor

@bearomorphism bearomorphism commented May 15, 2025

Description

  • Removed EOLTypes. I think it's unnecessary.
  • It's probably not a good practice to name a variable map.
  • Improve clarity of type hints.
  • Extract some subroutines to improve readability.

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

Expected Behavior

Steps to Test This Pull Request

Additional Context

Copy link

codecov bot commented May 15, 2025

Codecov Report

Attention: Patch coverage is 98.29060% with 2 lines in your changes missing coverage. Please review.

Project coverage is 98.25%. Comparing base (120d514) to head (9430778).
Report is 610 commits behind head on master.

Files with missing lines Patch % Lines
commitizen/commands/init.py 97.75% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1417      +/-   ##
==========================================
+ Coverage   97.33%   98.25%   +0.91%     
==========================================
  Files          42       57      +15     
  Lines        2104     2637     +533     
==========================================
+ Hits         2048     2591     +543     
+ Misses         56       46      -10     
Flag Coverage Δ
unittests 98.25% <98.29%> (+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.

Copy link
Member

@noirbizarre noirbizarre left a comment

Choose a reason for hiding this comment

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

Good cleanup, thanks!
For the f-string remark, I'll let @Lee-W decide

Comment on lines -44 to +46
'version = "0.0.1"\n'
"update_changelog_on_bump = true\n"
"major_version_zero = true\n"
'version = "0.0.1"\n'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure whether the order is important. If so, I think we can enforce the order somewhere.

@bearomorphism bearomorphism force-pushed the refactor-git branch 4 times, most recently from 81f0034 to 08a1aa3 Compare May 16, 2025 09:32
@bearomorphism bearomorphism changed the title refactor(git): improve readability and remove map variable refactor(git,init): code cleanup May 16, 2025
@bearomorphism
Copy link
Contributor Author

It seems that some lines are not covered before this PR change. I'll try to cover them.

@bearomorphism
Copy link
Contributor Author

Just vibe tested the changes.

@bearomorphism bearomorphism marked this pull request as draft May 16, 2025 15:22
@@ -67,10 +71,10 @@ def is_php_composer(self) -> bool:
def latest_tag(self) -> str | None:
return get_latest_tag_name()

def tags(self) -> list | None:
def tags(self) -> list[str]:
"""Not a property, only use if necessary"""
if self.latest_tag is None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The expression here is always false. I'll consider removing the function for simplicity.

@bearomorphism bearomorphism force-pushed the refactor-git branch 2 times, most recently from 214be08 to d27ab71 Compare May 16, 2025 15:56
@bearomorphism bearomorphism marked this pull request as ready for review May 16, 2025 15:57
@bearomorphism bearomorphism marked this pull request as draft May 16, 2025 16:09
@bearomorphism bearomorphism force-pushed the refactor-git branch 2 times, most recently from cee142b to 2a7e8ed Compare May 16, 2025 16:44
@bearomorphism bearomorphism marked this pull request as ready for review May 16, 2025 16:44
@bearomorphism bearomorphism marked this pull request as draft May 16, 2025 17:03
@bearomorphism bearomorphism marked this pull request as ready for review May 16, 2025 17:21
@bearomorphism
Copy link
Contributor Author

Finally passed codecov/patch check...

@bearomorphism bearomorphism force-pushed the refactor-git branch 3 times, most recently from 5538439 to 5f0faae Compare May 16, 2025 18:02
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.

3 participants