Skip to content

Don't break Ruff TOML config when adding Import Linter#865

Merged
nathanjmcdougall merged 10 commits intomainfrom
862-usethis-tool-import-linter-can-break-pyprojecttoml
Jul 18, 2025
Merged

Don't break Ruff TOML config when adding Import Linter#865
nathanjmcdougall merged 10 commits intomainfrom
862-usethis-tool-import-linter-can-break-pyprojecttoml

Conversation

@nathanjmcdougall
Copy link
Copy Markdown
Collaborator

No description provided.

@nathanjmcdougall nathanjmcdougall linked an issue Jul 17, 2025 that may be closed by this pull request
@nathanjmcdougall nathanjmcdougall changed the title Don't break TOML config when adding Import Linter Don't break Ruff TOML config when adding Import Linter Jul 17, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Jul 18, 2025

CodSpeed Instrumentation Performance Report

Merging #865 will not alter performance

Comparing 862-usethis-tool-import-linter-can-break-pyprojecttoml (1275e71) with main (02c2a50)

Summary

✅ 2 untouched benchmarks

@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review July 18, 2025 10:40
@nathanjmcdougall nathanjmcdougall requested a review from Copilot July 18, 2025 10:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_existing function to properly handle deeply nested TOML keys
  • Fixed parameter naming inconsistencies in the TOML I/O operations
  • Updated the extend_list method to use the improved _set_value_in_existing logic instead of mergedeep.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

@nathanjmcdougall nathanjmcdougall merged commit 685d685 into main Jul 18, 2025
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 862-usethis-tool-import-linter-can-break-pyprojecttoml branch July 18, 2025 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

usethis tool import-linter can break pyproject.toml

2 participants