From 5a4b64fbc373164998d89db582b3c374db0560fd Mon Sep 17 00:00:00 2001 From: Choko Date: Fri, 10 May 2024 17:49:28 +0900 Subject: [PATCH] Add lint-yaml (#2) --- .github/workflows/ci.yaml | 8 ++++++-- .yamllint.yaml | 4 ++++ standard.go | 20 +++++++++++++++++--- versions.go | 1 + 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 .yamllint.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 704eb8c..c00bad9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,5 +29,9 @@ jobs: **/go.sum versions.go - - name: run checks - run: go run build check + - name: run lints + if: startsWith(matrix.os, 'ubuntu-') + run: go run build -v lint + + - name: run tests + run: go run build -v test diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..68c4b4e --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,4 @@ +rules: + document-start: disable + truthy: + check-keys: false diff --git a/standard.go b/standard.go index 06e1087..65b5ab8 100644 --- a/standard.go +++ b/standard.go @@ -30,14 +30,28 @@ func DefineTasks(opts ...Option) { }, }) - lint := goyek.Define(goyek.Task{ - Name: "lint", - Usage: "Lints the code.", + lintGo := goyek.Define(goyek.Task{ + Name: "lint-go", + Usage: "Lints Go code.", Action: func(a *goyek.A) { cmd.Exec(a, fmt.Sprintf("go run github.com/golangci/golangci-lint/cmd/golangci-lint@%s run --timeout=20m", verGolangCILint)) }, }) + lintYaml := goyek.Define(goyek.Task{ + Name: "lint-yaml", + Usage: "Lints Yaml code.", + Action: func(a *goyek.A) { + cmd.Exec(a, fmt.Sprintf("go run github.com/wasilibs/go-yamllint/cmd/yamllint@%s .", verGoYamllint)) + }, + }) + + lint := goyek.Define(goyek.Task{ + Name: "lint", + Usage: "Lints code in various languages.", + Deps: goyek.Deps{lintGo, lintYaml}, + }) + test := goyek.Define(goyek.Task{ Name: "test", Usage: "Runs unit tests.", diff --git a/versions.go b/versions.go index 193a88f..4ac3050 100644 --- a/versions.go +++ b/versions.go @@ -5,4 +5,5 @@ const ( verGolangCILint = "v1.58.1" verGosImports = "v0.3.8" verGoFumpt = "v0.6.0" + verGoYamllint = "v1.35.1" )