From 161256150f52bf466a5a141d784be01415be5ad9 Mon Sep 17 00:00:00 2001 From: Edgar Ochoa Date: Tue, 31 Mar 2026 17:27:03 +0200 Subject: [PATCH 1/2] docs: update readme with requirements and details --- README.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 389d4bd..79f6a2e 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,26 @@ # Pre-commit hook for Dataform -This repository contains a pre-commit hook that allows you to automate the formatting of SQL and JS code in your Dataform project before each commit. The hook uses the `dataform format` command to format SQLX and JS files. +This repository contains pre-commit hooks to automate checks for Dataform projects before each commit. -It also includes a hook that runs `dataform compile` before each commit to ensure that your Dataform project compiles successfully. +## Requirements -### How to Use +- **Dataform CLI**: You must have the [Dataform CLI](https://cloud.google.com/dataform/docs/use-dataform-cli) installed locally in your environment for these hooks to function, as they depend on the `dataform` executable. -``` +## Available Hooks + +### `dataform_format` +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. + +### `dataform_compile` +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. + +## How to Use + +Add the following configuration to your project's `.pre-commit-config.yaml` file: + +```yaml - repo: https://github.com/devoteamgcloud/pre-commit-dataform - rev: [Fill with latest release] + rev: [Fill with latest release tag] hooks: - id: dataform_format - id: dataform_compile From 8acbb892618239323f8bde0b39b3078c5c64d252 Mon Sep 17 00:00:00 2001 From: Edgar Ochoa Date: Tue, 31 Mar 2026 17:32:49 +0200 Subject: [PATCH 2/2] docs: add node.js version recommendation to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 79f6a2e..4f3cbe0 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ This repository contains pre-commit hooks to automate checks for Dataform projec ## Requirements - **Dataform CLI**: You must have the [Dataform CLI](https://cloud.google.com/dataform/docs/use-dataform-cli) installed locally in your environment for these hooks to function, as they depend on the `dataform` executable. +- **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. ## Available Hooks