refactor(init): replace self.config.settings with DEFAULT_SETTINGS - #1832
Open
bearomorphism wants to merge 1 commit into
Open
refactor(init): replace self.config.settings with DEFAULT_SETTINGS#1832bearomorphism wants to merge 1 commit into
bearomorphism wants to merge 1 commit into
Conversation
bearomorphism
requested review from
Lee-W,
noirbizarre and
woile
as code owners
January 31, 2026 13:17
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1832 +/- ##
=======================================
Coverage 98.23% 98.23%
=======================================
Files 61 61
Lines 2779 2779
=======================================
Hits 2730 2730
Misses 49 49 ☔ View full report in Codecov by Harness. |
Member
|
conflict. convert it to draft |
bearomorphism
marked this pull request as draft
February 2, 2026 02:24
bearomorphism
force-pushed
the
default-settings-init
branch
from
May 9, 2026 08:45
a72772d to
78956b5
Compare
bearomorphism
marked this pull request as ready for review
May 9, 2026 08:45
30 tasks
Manny7717
approved these changes
Aug 31, 2026
Manny7717
left a comment
There was a problem hiding this comment.
Verified behavior-preserving refactor (head 78956b5):
get_version_scheme(DEFAULT_SETTINGS, version_scheme)—version_schemeis always passed explicitly from_ask_version_scheme()(aquestionary.selectover KNOWN_SCHEMES), so thesettingsargument is only consulted for the deprecatedversion_typefallback whennameis None — unreachable here. No behavior change.encoding=DEFAULT_SETTINGS["encoding"](write + read of.pre-commit-config.yaml) —Init.__call__early-returns whenself.config.pathexists (init.py:88-90), so the only reachable path hasconfig.settings== aDEFAULT_SETTINGS.copy()(base_config.py:20, no config data loaded). Identical values, same behavior. This also removes the latent coupling to whatever a future config-loading path might inject.
- tests/commands/test_init_command.py: 30/30 pass on head.
- CI matrix green (python-check 3.10-3.14 × 3 OS, check-links, codecov).
Agreed this is the right direction for #1831. One non-blocking note for a follow-up: the remaining self.config uses in init.py (e.g. self.config.settings in _get_config_data's fallback and self.cz) could get the same treatment once #1831's discussion settles on the full scope.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #1831
In usual use cases,
self.config.settingsis a copy ofDEFAULT_SETTINGSThis probably makes more sense. wdyt