Skip to content

219 properly handle other ruff configuration files#398

Merged
nathanjmcdougall merged 33 commits intomainfrom
219-properly-handle-other-ruff-configuration-files
Mar 16, 2025
Merged

219 properly handle other ruff configuration files#398
nathanjmcdougall merged 33 commits intomainfrom
219-properly-handle-other-ruff-configuration-files

Conversation

@nathanjmcdougall
Copy link
Copy Markdown
Collaborator

Lots of TODOs still to go but it's time to see how performance is affected.

@nathanjmcdougall nathanjmcdougall linked an issue Mar 15, 2025 that may be closed by this pull request
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 15, 2025

CodSpeed Performance Report

Merging #398 will not alter performance

Comparing 219-properly-handle-other-ruff-configuration-files (a6d4769) with main (ba7f9ea)

Summary

✅ 1 untouched benchmarks

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.39%. Comparing base (ba7f9ea) to head (a6d4769).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #398      +/-   ##
==========================================
+ Coverage   98.15%   98.39%   +0.23%     
==========================================
  Files          72       69       -3     
  Lines        3095     3113      +18     
==========================================
+ Hits         3038     3063      +25     
+ Misses         57       50       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review March 16, 2025 09:44
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 refactors the handling of TOML configuration files by introducing a new context manager (files_manager) to consolidate access to various TOML managers and by removing legacy pyproject.toml helper modules. Key changes include:

  • Introducing files_manager in src/usethis/_config_file.py and corresponding classes (DotRuffTOMLManager and RuffTOMLManager) for managing TOML files.
  • Replacing all direct usages of PyprojectTOMLManager with files_manager across modules, tests, and CLI interfaces.
  • Removing legacy modules (e.g. the pyproject_toml core and Ruff rules helpers) that are no longer required.

Reviewed Changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/usethis/_config_file.py Adds a new files_manager context manager and TOML manager classes for handling .ruff.toml and ruff.toml.
src/usethis/integrations/file/toml/io.py Refactors the base TOML file manager to use a unified property (self.path) and adds extra helper methods.
tests/usethis/_core/test_core_ci.py Replaces direct PyprojectTOMLManager usage with files_manager in tests.
Various files under src/usethis/_interface/ Updates CLI command context managers to use files_manager instead of PyprojectTOMLManager.
Other integration files (sonarqube, uv, deps, etc.) Update accesses to TOML configuration values using the new files_manager and remove legacy code.
pyproject.toml Updates layers and module lists to reflect the removal of legacy components.
Comments suppressed due to low confidence (1)

src/usethis/_config_file.py:15

  • [nitpick] The files_manager context manager yields nothing, which may be confusing for consumers expecting to work with an instance or a composite manager. Consider yielding a meaningful composite object (or documenting that it serves only to initialize multiple managers) to clarify its intended use.
def files_manager() -> Iterator[None]:

@nathanjmcdougall nathanjmcdougall merged commit ae24f0f into main Mar 16, 2025
15 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 219-properly-handle-other-ruff-configuration-files branch March 16, 2025 11:28
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.

Properly handle other ruff configuration files

3 participants