This repository contains pre-commit hooks to automate checks for Dataform projects before each commit.
- Dataform CLI: You must have the Dataform CLI installed locally in your environment for these hooks to function, as they depend on the
dataformexecutable. - Node.js: It's recommended to use Node.js v20 or lower, as newer versions (like v22+) might be incompatible with current Dataform CLI dependencies.
This hook automates the formatting of SQL and JS code in your Dataform project. It runs the dataform format command against your .sqlx and .js files, ensuring consistent code style across your repository.
This hook runs the dataform compile command before each commit to ensure that your Dataform project compiles successfully. It acts as an early validation step to prevent pushing broken definitions to your repository.
Add the following configuration to your project's .pre-commit-config.yaml file:
- repo: https://github.com/devoteamgcloud/pre-commit-dataform
rev: [Fill with latest release tag]
hooks:
- id: dataform_format
- id: dataform_compile