Skip to content

Add managed per-file-ignore support; ignore RUF059 in tests by default#1463

Merged
nathanjmcdougall merged 8 commits into
mainfrom
copilot/disable-unused-variables-rule
Mar 24, 2026
Merged

Add managed per-file-ignore support; ignore RUF059 in tests by default#1463
nathanjmcdougall merged 8 commits into
mainfrom
copilot/disable-unused-variables-rule

Conversation

Copilot AI commented Mar 22, 2026

Copy link
Copy Markdown
Contributor
  • Add tests_ignored and nontests_ignored fields to RuleConfig (managed per-file-ignore equivalents of existing unmanaged fields)
  • Update RuleConfig methods: subset_related_to_tests, empty, is_related_to_tests, __repr__, __or__
  • Add unignore_rules_in_glob method to RuffTool
  • Update apply_rule_config in RuffTool to handle managed per-file-ignores
  • Update remove_rule_config in RuffTool to handle managed per-file-ignores
  • Add RUF059 to _get_basic_rule_config() as a tests_ignored rule
  • Add tests for the new behavior
  • Add tests for full coverage of RuleConfig.__repr__
  • Run static checks and verify
  • Code review and security checks
Original prompt

This section details on the original issue you should resolve

<issue_title>RUF059 should not be used in the test suite by default</issue_title>
<issue_description>Anything about unused variables should be disabled for the test suite

i.e. in the config for Ruff, it is an ignored, managed test rule. Might need to add a new attribute for that category, I haven't checked.</issue_description>

Comments on the Issue (you are @copilot in this section)


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI and others added 3 commits March 22, 2026 19:09
…ault

- Add `tests_ignored` and `nontests_ignored` fields to `RuleConfig` for managed
  per-file-ignores (can be removed when tool is removed)
- Add `unignore_rules_in_glob` method to `RuffTool` for removing per-file-ignores
- Update `apply_rule_config` to handle managed per-file-ignores
- Update `remove_rule_config` to handle managed per-file-ignores
- Add `RUF059` to `_get_basic_rule_config()` as a `tests_ignored` rule
- Add tests for new behavior
- Update existing test expectations

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/1a70829b-ea2b-443e-9475-5cd4a579a3b9
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/1a70829b-ea2b-443e-9475-5cd4a579a3b9
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/1a70829b-ea2b-443e-9475-5cd4a579a3b9
Copilot AI changed the title [WIP] Disable unused variables rule in test suite for Ruff Add managed per-file-ignore support; ignore RUF059 in tests by default Mar 22, 2026
Copilot AI requested a review from nathanjmcdougall March 22, 2026 19:13
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review March 22, 2026 19:26
@codspeed-hq

codspeed-hq Bot commented Mar 22, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 3.35%

❌ 1 regressed benchmark
✅ 1 untouched benchmark

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation test_several_tools_add_and_remove 834.9 ms 863.9 ms -3.35%

Comparing copilot/disable-unused-variables-rule (1280688) with main (ba2fd04)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (8304372) during the generation of this report, so ba2fd04 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@codecov

codecov Bot commented Mar 22, 2026

Copy link
Copy Markdown

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!

@nathanjmcdougall

Copy link
Copy Markdown
Collaborator

@copilot please add a test for full coverage of RuleConfig.__repr__

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/692d2eb5-b2c9-4970-8ec5-b1c5737da738

Copilot AI commented Mar 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please add a test for full coverage of RuleConfig.__repr__

Added in fbce5f2. Created tests/usethis/_tool/test_rule.py with 10 tests covering every branch: empty config, each individual field, and all fields populated together.

@nathanjmcdougall nathanjmcdougall merged commit c630de4 into main Mar 24, 2026
19 of 20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/disable-unused-variables-rule branch March 24, 2026 04:27
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.

RUF059 should not be used in the test suite by default

2 participants