Skip to content

Commit

Permalink
move .tf formatting to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jooola committed Nov 11, 2024
1 parent 5104281 commit fb3f552
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,22 @@ repos:
hooks:
- id: shellcheck
args: [--shell, bash]

- repo: local
hooks:
- id: opentofu_fmt
name: opentofu_fmt
description: Format all .tf files to a canonical format.
language: docker_image
entry: ghcr.io/opentofu/opentofu fmt
files: \.tf$

- repo: local
hooks:
- id: generate
name: generate
description: Ensure generated files are up to date
language: golang
entry: make generate
pass_filenames: false
files: (^examples/|\.go$)
3 changes: 3 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ _output/terraform-provider-hcloud_%.zip: bin/%/terraform-provider-hcloud
cp bin/$*/terraform-provider-hcloud README.md CHANGELOG.md LICENSE $(DEST)
cd $(DEST) && zip -r ../$(NAME).zip .

generate:
go -C ./tools generate ./...

lint:
golangci-lint run --fix

Expand Down
2 changes: 0 additions & 2 deletions tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ import (
_ "github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs"
)

//go:generate terraform fmt -recursive ../examples

//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-dir .. -provider-name hcloud

0 comments on commit fb3f552

Please sign in to comment.