Skip to main content

Formatting

Formatting guidelines in the repository.

Formatting is enforced by Pull Requests checks.

Overview

You can use this make target to format all code in the project automatically.

make format
note

The repository includes a .vscode/settings.json file that will format code on save if you are using Visual Studio Code.

Rust

We adhere to the Rust style guide. Use cargo to format your code.

cargo fmt

Go

We adhere to the style produced by the gofmt tool. Use this tool to format all Go code.

gofmt -w -s tools/

Python

We adhere to the style produced by black to format all Python code.

python3 -m black . --exclude "azure-linux-image-tools"

You can use make format to format all python files in the project automatically.

You can manually invoke it with black <file>, or black <dir> to format all files in a directory.

Recommended version: 23.12 or newer.