clean¶
Clean and format project code.
Syntax¶
Arguments¶
| Name | Required | Description |
|---|---|---|
paths |
No | Paths to clean; defaults to current directory |
Options¶
| Short | Long | Default | Description |
|---|---|---|---|
| - | --check |
False |
Exit with error if changes are needed |
-y |
--yes |
False |
Skip interactive confirmations |
Examples¶
Clean the current directory:
Clean specific paths:
Check formatting in CI:
Skip confirmation:
Output Notes / Common Errors¶
- Default tool chain is
autoflakeandblack; customize via[clean]in the config file. --checkreturns a non-zero exit code if any file would be reformatted.- When external tools such as
autoflake/blackare not available, clean falls back to a built-in formatter automatically.
Built-in Formatter¶
When the external toolchain is incomplete, clean uses a built-in formatter that handles the following file types:
.py .pyi .pyx .pxd .js .ts .jsx .tsx .rs .go .java .c .cpp .h .rb
Formatting scope: - Strip trailing whitespace from each line - Collapse multiple consecutive blank lines into a single blank line - Compress runs of 2+ inline spaces into a single space (preserving indentation and string literals) - Ensure the file ends with exactly one trailing newline