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

Skip to content

Conversation

bearomorphism
Copy link
Contributor

…move unnecessary variable assignment

Description

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

Copy link

codecov bot commented Sep 14, 2025

Codecov Report

❌ Patch coverage is 96.36364% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.18%. Comparing base (120d514) to head (94b34ee).
⚠️ Report is 805 commits behind head on master.

Files with missing lines Patch % Lines
commitizen/config/__init__.py 93.10% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1601      +/-   ##
==========================================
+ Coverage   97.33%   98.18%   +0.84%     
==========================================
  Files          42       58      +16     
  Lines        2104     2696     +592     
==========================================
+ Hits         2048     2647     +599     
+ Misses         56       49       -7     
Flag Coverage Δ
unittests 98.18% <96.36%> (+0.84%) ⬆️

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.

@@ -22,7 +22,6 @@
class JsonConfig(BaseConfig):
def __init__(self, *, data: bytes | str, path: Path | str) -> 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.

I think we can remove the str of the parameter path in the future? I'm not sure if that will be 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.

I think it's fine to remove the str, at most, it would generate a mypy error

self._settings: Settings = DEFAULT_SETTINGS.copy()
self.encoding = self.settings["encoding"]
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'm not sure why this member variable exists. It will be stale if self._settings is updated somewhere.

@bearomorphism bearomorphism marked this pull request as draft September 15, 2025 02:33
@bearomorphism bearomorphism marked this pull request as ready for review September 15, 2025 05:06
@@ -17,8 +17,8 @@

class BaseConfig:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this be an abstract class?

Copy link
Member

Choose a reason for hiding this comment

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

Ideally, a Protocol, but it doesn't hurt like this

Copy link
Contributor Author

@bearomorphism bearomorphism Sep 15, 2025

Choose a reason for hiding this comment

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

Thanks. I found it odd that we can create BaseConfig objects and it's sometimes confusing. I attempted to refactor it on another branch (not published yet) but many tests would be affected.

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