Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always write empty fixes on Ruff >= 0.1.6 #319

Merged
merged 1 commit into from
Nov 10, 2023
Merged

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Nov 10, 2023

Summary

We can avoid the safeguard we introduced in #317 for newer Ruff versions, since Ruff will now avoid writing empty output for excluded files (see: astral-sh/ruff#8596).

Closes #267.

Test Plan

I tested this with a local debug build. Now, when I "Fix all" on a non-excluded file with import os, it does properly get removed, while running "Format" or "Fix all" on an excluded file leaves the contents untouched.

@@ -140,10 +140,10 @@ class VersionModified(NamedTuple):
# Require at least Ruff v0.0.291 for formatting, but allow older versions for linting.
VERSION_REQUIREMENT_FORMATTER = SpecifierSet(">=0.0.291,<0.2.0")
VERSION_REQUIREMENT_LINTER = SpecifierSet(">=0.0.189,<0.2.0")
# Version requirement for use of the "ALL" rule selector
VERSION_REQUIREMENT_ALL_SELECTOR = SpecifierSet(">=0.0.198,<0.2.0")
Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out this is now unused.

@charliermarsh charliermarsh added the bug Something isn't working label Nov 10, 2023
@charliermarsh charliermarsh changed the title Always write empty fixes on Ruff >= 0.1.5 Always write empty fixes on Ruff >= 0.1.6 Nov 10, 2023
@charliermarsh charliermarsh force-pushed the charlie/empty branch 2 times, most recently from fb4e633 to 99469b0 Compare November 10, 2023 04:42
@charliermarsh charliermarsh merged commit 0edc51e into main Nov 10, 2023
20 checks passed
@charliermarsh charliermarsh deleted the charlie/empty branch November 10, 2023 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatting and "Fix All" doesn't work if it removes entire file content
2 participants