Skip to content

Don't duplicate ignored rules matching glob#1042

Merged
nathanjmcdougall merged 1 commit intomainfrom
935-dont-add-a-duplicate-inp-rule-when-running-usethis-tool-import-linter-multiple-times
Oct 26, 2025
Merged

Don't duplicate ignored rules matching glob#1042
nathanjmcdougall merged 1 commit intomainfrom
935-dont-add-a-duplicate-inp-rule-when-running-usethis-tool-import-linter-multiple-times

Conversation

@nathanjmcdougall
Copy link
Copy Markdown
Collaborator

No description provided.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 26, 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 Oct 26, 2025

CodSpeed Performance Report

Merging #1042 will not alter performance

Comparing 935-dont-add-a-duplicate-inp-rule-when-running-usethis-tool-import-linter-multiple-times (d4f98ea) with main (6d6cb4f)

Summary

✅ 2 untouched

@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review October 26, 2025 09:45
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 ignored rules for a specific glob pattern could be duplicated when ignore_rules_in_glob was called multiple times with the same rules. The fix checks for existing ignored rules before adding new ones.

Key Changes:

  • Added deduplication logic to ignore_rules_in_glob method
  • Introduced new helper method get_ignored_rules_in_glob to retrieve currently ignored rules for a glob pattern
  • Added test case to verify duplicate rules are prevented

Reviewed Changes

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

File Description
src/usethis/_tool/impl/ruff.py Implements deduplication logic in ignore_rules_in_glob and adds new get_ignored_rules_in_glob helper method
tests/usethis/_core/test_core_tool.py Adds regression test to verify duplicate INP rules are not added when use_import_linter is called multiple times

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nathanjmcdougall nathanjmcdougall merged commit 783e84c into main Oct 26, 2025
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 935-dont-add-a-duplicate-inp-rule-when-running-usethis-tool-import-linter-multiple-times branch October 26, 2025 09:48
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.

Don't add a duplicate INP rule when running usethis tool import-linter multiple times

2 participants