LinuxCommandLibrary

ruff-format

Format Python code automatically

TLDR

Format given files or directories in-place

$ ruff format [path/to/file_or_directory1 path/to/file_or_directory2 ...]
copy

Print which files would have been modified and return a non-zero exit code if there are files to reformat, and zero otherwise
$ ruff format --check
copy

Print what changes would be made without modifying the files
$ ruff format --diff
copy

SYNOPSIS

ruff format [OPTIONS] [FILES_OR_DIRECTORIES...]
ruff format [OPTIONS] --stdin

PARAMETERS

-c, --config
    Specify a configuration file or directory containing a pyproject.toml.

--check
    Check for formatting violations without writing changes.

--diff
    Print a diff of formatting changes instead of applying them.

--write
    Write changes to disk (default behavior for files).

--line-length
    Set the preferred maximum line length for formatting.

--indent