ruff_format¶
RuffFormat ¶
Bases: Tool[_R]
Methods:
| Name | Description |
|---|---|
__call__ |
Run the Ruff formatter on the given files or directories |
Attributes:
| Name | Type | Description |
|---|---|---|
argv |
RuffFormat[Argv]
|
|
__call__ ¶
__call__(*args: str | PathLike[str], cache_dir: Value = ..., check: Flag = ..., color: Color | Sequence[Color] | None = ..., config: Value = ..., diff: Flag = ..., exclude: Value = ..., exit_non_zero_on_format: Flag = ..., extend_exclude: Value = ..., extension: Value = ..., force_exclude: Flag = ..., isolated: Flag = ..., line_length: Value = ..., no_cache: Flag = ..., output_format: OutputFormat | Sequence[OutputFormat] | None = ..., preview: Flag = ..., quiet: Flag = ..., range: Value = ..., respect_gitignore: Flag = ..., silent: Flag = ..., stdin_filename: Value = ..., target_version: TargetVersion | Sequence[TargetVersion] | None = ..., verbose: Flag = ..., **flags: Any) -> _R
Run the Ruff formatter on the given files or directories
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cache_dir
|
Value
|
Path to the cache directory. |
...
|
check
|
Flag
|
Avoid writing any formatted files back; instead, exit with a non-zero status code if any files would have been modified, and zero otherwise. |
...
|
color
|
Color | Sequence[Color] | None
|
Control when colored output is used. |
...
|
config
|
Value
|
Either a path to a TOML configuration file ( |
...
|
diff
|
Flag
|
Avoid writing any formatted files back; instead, exit with a non-zero status code and the difference between the current file and how the formatted file would look like. |
...
|
exclude
|
Value
|
List of paths, used to omit files and/or directories from analysis. |
...
|
exit_non_zero_on_format
|
Flag
|
Exit with a non-zero status code if any files were modified via format, even if all files were formatted successfully. |
...
|
extend_exclude
|
Value
|
Like --exclude, but adds additional files and directories on top of those already excluded. Added in 0.15.21. |
...
|
extension
|
Value
|
List of mappings from file extension to language (one of |
...
|
force_exclude
|
Flag
|
Enforce exclusions, even for paths passed to Ruff directly on the command-line. |
...
|
isolated
|
Flag
|
Ignore all configuration files. |
...
|
line_length
|
Value
|
Set the line-length. |
...
|
no_cache
|
Flag
|
Disable cache reads. |
...
|
output_format
|
OutputFormat | Sequence[OutputFormat] | None
|
Output serialization format for violations, when used with |
...
|
preview
|
Flag
|
Enable preview mode; enables unstable formatting. |
...
|
quiet
|
Flag
|
Print diagnostics, but nothing else. |
...
|
range
|
Value
|
When specified, Ruff will try to only format the code in the given range. |
...
|
respect_gitignore
|
Flag
|
Respect file exclusions via |
...
|
silent
|
Flag
|
Disable all logging (but still exit with status code "1" upon detecting diagnostics). |
...
|
stdin_filename
|
Value
|
The name of the file when passing it through stdin. |
...
|
target_version
|
TargetVersion | Sequence[TargetVersion] | None
|
The minimum Python version that should be supported. |
...
|
verbose
|
Flag
|
Enable verbose logging. |
...
|