Code formatting
Tools
🐍 Python
We use Ruff for Python code formatting and import sorting. Our Ruff configuration is in the pyproject.toml file.
Ruff is monorepo-friendly and supports nested inherited configuration; each sub-project can optionally override Ruff lint and formatting settings in their own pyproject.toml
files, as needed per project.
Ruff auto-detects the proper package classification so that "local", "first party" and "third party" imports are sorted and grouped correctly, even within subprojects of the monorepo.
☕ Java
We format our Java code using Spotless. Our configuration for Spotless is in the spotless-maven-pom.xml file.
Json and Yaml
We format our Json and Yaml files using prettier.
Local Formatting
We wrapped our code formatting tools in pre-commit. You can install this and other local dev tools by running make tools.install
.
You can execute pre-commit
to format modified files, or pre-commit run --all-files
to format all the code your local airbyte
repository.
Pre-push Git Hooks
A pre-push git hook is available, which you can enable with:
make tools.git-hooks.install
You can also uninstall git hooks with:
make tools.git-hooks.clean
CI Checks and /format-fix
Slash Command
In the CI we run the pre-commit run --all-files
command to check that all the code is formatted.
If it is not, CI will fail and you will have to run pre-commit run --all-files
locally to fix the formatting issues. Alternatively, maintainers with write permissions can run the /format-fix
GitHub slash command to auto-format the entire repo and commit the result back to the open PR.