Skip to content

git_ruff: Implement suggestion application #45

@SwooshyCueb

Description

@SwooshyCueb

At present, git_ruff.py generates diffs when a change is suggested. One unified diff is generated per suggestion. We do not generate one diff for the entire run for a few different reasons:

  • Due to newline normalization, the generated diffs may not work with tools such as patch.
  • Every change suggested by ruff is a judgement call. Applying a bunch of changes without consideration is reckless.
  • Ruff may have more than one suggestion for how to fix a failed check. This cannot be represented in a single unified diff.

However, as other team members have pointed out, manually applying a large number of suggested changes can be cumbersome. Let's implement the ability to apply suggested changes interactively, similar to git add -p. Additionally, for cases where there are no overlapping suggestions, we can provide the option to apply all suggested changes at once (even though it may be a bad idea to do so).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions