Format
Formatters help your code be consistent, beautiful and more maintainable.
formatBash
Ensure that Bash code is formatted according to shfmt.
Types:
- formatBash:
- enable (
boolean
): Optional. Defaults to false. - targets (
listOf str
): Optional. Files or directories (relative to the project) to format. Defaults to the entire project.
- enable (
Example:
formatMarkdown
Warning
This function is only available on Linux at the moment.
Ensure that Markdown code is formatted according to doctoc.
Types:
- formatMarkdown:
- enable (
boolean
): Optional. Defaults tofalse
. - doctocArgs (
listOf str
): Optional. Extra CLI flags to propagate to doctoc. Defaults to[ ]
. - targets (
listOf str
): File s (relative to the project) to format.
- enable (
Example:
formatNix
Ensure that Nix code is formatted according to nixfmt.
Types:
- formatNix:
- enable (
boolean
): Optional. Defaults tofalse
. - targets (
listOf str
): Optional. Files or directories (relative to the project) to format. Defaults to the entire project.
- enable (
Example:
formatPython
Ensure that Python code is formatted according to Black and isort.
Types:
- formatPython (
attrsOf targetType
): Optional. Mapping of names to format targets. Defaults to{ }
. - targetType (
submodule
):- config (
atrrs
): Optional.- black (
path
): Optional. Path to the Black configuration file. Defaults to ./settings-black.toml. - isort (
path
): Optional. Path to the isort configuration file. Defaults to ./settings-isort.toml.
- black (
- targets (
listOf str
): Optional. Files or directories (relative to the project) to format. Defaults to the entire project.
- config (
Example:
formatTerraform
Ensure that Terraform code is formatted according to Terraform FMT.
Types:
- formatTerraform:
- enable (
boolean
): Optional. Defaults tofalse
. - targets (
listOf str
): Optional. Files or directories (relative to the project) to format. Defaults to the entire project.
- enable (
Example:
formatYaml
Ensure that YAML code is formatted according to yamlfix.
Types:
- formatYaml:
- enable (
boolean
): Optional. Defaults tofalse
. - targets (
listOf str
): Optional. Files or directories (relative to the project) to format. Defaults to the entire project.
- enable (
Example: