Skip to content

fmt

Description

Format code using the configured formatters.

Required Parameters:

None

Optional Parameters:

path (-p): Path to code to format. (Default: None)
    - If not provided, formats all packages
    - Can be file or directory path
    - Must exist in workspace

changed_only (-co): Only format files that have changed. (Default: False)
    - Uses git to detect changes
    - Only formats files with uncommitted changes
    - Ignores untracked files

Usage: Format all packages: adev fmt

Format specific path:
    adev fmt -p ./my_package

Format only changed files:
    adev fmt --changed-only

Format specific path and only changed files:
    adev fmt -p ./my_package --changed-only

Notes

Formatters:
    - black: Python code formatting
    - isort: Import sorting
    - docformatter: Docstring formatting

Features:
    - Parallel processing for faster formatting
    - Configurable via pyproject.toml
    - Consistent code style enforcement
    - Auto-fixes formatting issues
    - Shows formatting statistics

Integration:
    - Works with pre-commit hooks
    - CI/CD pipeline support
    - Editor/IDE integration
    - Custom configuration support

Error Handling:
    - Reports formatting failures
    - Shows detailed error messages
    - Exits with error on failure
    - Preserves file content on error

Returns

None