Skip to content

Formatter: Add an option to show formatting changes when running --check #7231

@MichaReiser

Description

@MichaReiser

There are two options:

  1. Add a new --diff option to ruff format --check that prints the formatting changes similar to Black
  2. --check uses Ruff's diagnostic system and shows diffs for format: human but not for format: compact (which would enable diffs by default)

I prefer option 2.

Open questions

  • Should this be integrated into our diagnostic system?
  • Should it print the entire diff or collapse very large code frames
  • Which diffing library to use. We ran into exponential back-tracking cases in our cargo dev script for large files / large changes

CC @zanieb regarding CLI design

Metadata

Metadata

Assignees

Labels

cliRelated to the command-line interfaceformatterRelated to the formatter

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions