diff --git a/.versions b/.versions index 5afe3c84b2..aabd90daf2 100644 --- a/.versions +++ b/.versions @@ -1 +1,2 @@ GOLANGCI_LINT_VERSION=2.10.1 +YAMLFMT_VERSION=0.21.0 diff --git a/.yamlfmt b/.yamlfmt new file mode 100644 index 0000000000..54bdb31463 --- /dev/null +++ b/.yamlfmt @@ -0,0 +1,10 @@ +formatter: + type: basic + basic_formatter_config: + indent: 2 + include_document_start: false + retain_line_breaks_single: true +exclude: + - cmd/** + - internal/** + - public/** diff --git a/Taskfile.yml b/Taskfile.yml index 561cd178b0..327900d3e6 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -34,7 +34,9 @@ tasks: desc: Format code and tidy modules deps: - tools:install-golangci-lint + - tools:install-yamlfmt cmds: + - '{{.TOOLS_BIN_DIR}}/yamlfmt' - '{{.TOOLS_BIN_DIR}}/golangci-lint fmt cmd/... internal/... public/...' - go mod tidy diff --git a/taskfiles/tools.yml b/taskfiles/tools.yml index 71dc256e19..7a7b06bf7f 100644 --- a/taskfiles/tools.yml +++ b/taskfiles/tools.yml @@ -9,6 +9,7 @@ tasks: deps: - install-golangci-lint - install-govulncheck + - install-yamlfmt install-golangci-lint: desc: Install golangci-lint @@ -21,3 +22,10 @@ tasks: - .versions cmds: - GOBIN={{.GOBIN}} go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v{{.GOLANGCI_LINT_VERSION}} + + install-yamlfmt: + desc: Install yamlfmt + run: once + silent: true + cmds: + - GOBIN={{.GOBIN}} go install github.com/google/yamlfmt/cmd/yamlfmt@v{{.YAMLFMT_VERSION}}