-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
fixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
In some cases, a lint fix can drop comments. Retaining all comments was a major goal in the Ruff formatter and we've learned that it is very hard to accomplish. There is significant foundational work that would need to be invested in the linter to prevent it from ever dropping comments. While we would like to accomplish this eventually, we're a small team with a lot of priorities to balance. In the meantime, we want to formalize a policy for fixes that may drop comments.
A few options:
- A fix should not be offered if the range contains a comment
- A fix that may drop a comment must always be unsafe
- A fix that may drop a comment must be unsafe if a comment is present in the fix range
- A fix will only drop comments in ranges that use dangerous syntax e.g. line continuations
- A fix that may drop a comment is always safe — we do not make guarantees about comments
We currently apply a mix of these options, but we should be consistent. More options and discussion welcome.
Related issues and reports:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
fixesRelated to suggested fixes for violationsRelated to suggested fixes for violations