Don't break Ruff TOML config when adding Import Linter#865
Merged
nathanjmcdougall merged 10 commits intomainfrom Jul 18, 2025
Merged
Don't break Ruff TOML config when adding Import Linter#865nathanjmcdougall merged 10 commits intomainfrom
nathanjmcdougall merged 10 commits intomainfrom
Conversation
…d deep nesting bug.
This might focus Import Linter to build a graph of an actual package rather than looking inan unrelated lib dir
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. 📢 Thoughts on this report? Let us know! |
CodSpeed Instrumentation Performance ReportMerging #865 will not alter performanceComparing Summary
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where adding Import Linter would break existing Ruff TOML configurations when deeply nested keys were involved. The issue was in the TOML I/O handling where parameter names were inconsistent and the logic for handling nested configurations needed improvement.
- Refactored the
_set_value_in_existingfunction to properly handle deeply nested TOML keys - Fixed parameter naming inconsistencies in the TOML I/O operations
- Updated the
extend_listmethod to use the improved_set_value_in_existinglogic instead ofmergedeep.merge
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/usethis/integrations/file/toml/io.py | Core fix for TOML handling with improved parameter names and logic for nested keys |
| src/usethis/_tool/rule.py | Minor documentation improvement for rule configuration |
| tests/usethis/_tool/impl/test_ruff.py | Added test case for the Ruff configuration bug fix |
| tests/usethis/integrations/file/pyproject_toml/test_pyproject_toml_io.py | Added test for deep nesting in TOML configuration |
| tests/usethis/_core/test_core_tool.py | Added integration test for Import Linter not breaking Ruff config |
| tests/usethis/_interface/test_lint.py | Updated test assertions to be more specific |
| tests/usethis/_integrations/pre_commit/test_pre_commit_schema.py | Fixed test to use proper working directory context |
| tests/usethis/_integrations/ci/bitbucket/test_bitbucket_schema.py | Fixed test to use proper working directory context |
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.
No description provided.