Replies: 11 comments 19 replies
-
CC @charliermarsh @MichaReiser @evanrittenhouse @madkinsz Would love some initial thoughts, ideas |
Beta Was this translation helpful? Give feedback.
-
What happens if the user declines the fix? Does it get suppressed or just ignored? Should we add an option for adding a suppression comment? |
Beta Was this translation helpful? Give feedback.
-
I think it would be good to tackle this as a project on its own first. The current implementation is very naive and only really intended for testing purposes. For example, the diff doesn't properly display differences that are white spaces only (changing from spaces to tabs could be hard to see), or it renders the full range, possibly throwing a 100 line diff at you rather than collapsing the change at some point. |
Beta Was this translation helpful? Give feedback.
-
Would this apply all fixes for a single file or for all files? How does the user know which fixes would be applied? |
Beta Was this translation helpful? Give feedback.
-
Do you propose to review all files first and then re-lint or re-lint on a per-file level (applied all fixes for a file, re-lint that file)? |
Beta Was this translation helpful? Give feedback.
-
#4183 introduced three different applicability levels. How would you propose that the review mode works for these different levels? |
Beta Was this translation helpful? Give feedback.
-
On the contrary, you absolutely want the fix to introduce more errors! (Not syntax errors though!) a = 1
b = 2
c = a + b then |
Beta Was this translation helpful? Give feedback.
-
The proposed display is solid, I think, but I think we may want to add the filename and source code location (i.e., row and column) for each fix. Maybe filename persists at the top and each fix shows its row + column (and optionally more context around it, similar to |
Beta Was this translation helpful? Give feedback.
-
Are you proposing relinting after every user rule acceptance or after the user has gone through all errors from a specific lint run? For example, the proposed input display shows 4 errors (presumably in the same file). Do we re-lint that file 4 times or once after the user has checked all 4 errors? |
Beta Was this translation helpful? Give feedback.
-
We may also want to add some sort of |
Beta Was this translation helpful? Give feedback.
-
Do we want to break this down into smaller issues, or do some more hacking in this space |
Beta Was this translation helpful? Give feedback.
-
This discussion is in reference to this comment #4361 (comment) and this issue in general #4361. We would like to scope out the work invovled in setting up autofix for ruff. I think we can execute this in a series of steps
User Prompting
The modification or variant of apply_fixes should include the following features:
We already have
apply_fixes
which applies a set of fixes to the ones reported. We would need to modify or write a variant that would prompt the user that this is the fix that is being applied and this is how the new line will look.I tried hacking on some part of it and you can see it in a draft PR here, it is more of a proof of concept right now. One of the things I noticed right off the bat is we would like to print the line that is being modified along with the ones that it is going to be replaced with.
Draft PR: #4936
This is something that I hacked quickly and need to modify to get some better results.
Relinting the files once a fix has been applied.
This should be fairly straightforward. One thing we need to make sure is that the fix does not introduce any more errors. If so we abort the autofix.
Beta Was this translation helpful? Give feedback.
All reactions