Skip to content

Conversation

@self-sasi
Copy link

Summary

Fixes #2185

This change makes --remove-unused-ignores avoid rewriting files when there are no unused ignores to remove.

Files that have no ignore comments, or only have used ignore comments, are now left untouched. This prevents unnecessary file writes and avoids introducing formatting-only changes such as added newlines.

Test Plan

Added tests to verify no newline characters are appended to input when there are no unused ignores to remove.

@meta-cla meta-cla bot added the cla signed label Jan 24, 2026
Copy link

@gmacon gmacon left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks for implementing this.

Comment on lines +377 to 380
if ignore.is_empty() {
continue;
}
all_ignores.insert(path, ignore);
Copy link

Choose a reason for hiding this comment

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

I might structure this with a negative condition and avoid the continue, i.e.

Suggested change
if ignore.is_empty() {
continue;
}
all_ignores.insert(path, ignore);
if !ignore.is_empty() {
all_ignores.insert(path, ignore);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Don't unnecessarily rewrite files with --remove-unused-ignores

2 participants