Skip to content

Commit

Permalink
Add yaml and markdown tasks (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
chokoswitch authored May 29, 2024
1 parent a301ee0 commit ec40e94
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 19 deletions.
21 changes: 10 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Contributor Covenant Code of Conduct

## Our Pledge
Expand All @@ -18,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
- Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
- The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down
47 changes: 39 additions & 8 deletions standard.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ func DefineTasks(opts ...Option) {
}

formatGo := goyek.Define(goyek.Task{
Name: "format-go",
Usage: "Formats Go code.",
Name: "format-go",
Usage: "Formats Go code.",
Parallel: true,
Action: func(a *goyek.A) {
cmd.Exec(a, fmt.Sprintf("go run mvdan.cc/gofumpt@%s -l -w .", verGoFumpt))

Expand All @@ -30,10 +31,28 @@ func DefineTasks(opts ...Option) {
},
})

formatMarkdown := goyek.Define(goyek.Task{
Name: "format-markdown",
Usage: "Formats Markdown code.",
Parallel: true,
Action: func(a *goyek.A) {
cmd.Exec(a, fmt.Sprintf("go run github.com/wasilibs/go-prettier/cmd/prettier@%s --no-error-on-unmatched-pattern --write '**/*.md'", verGoPrettier))
},
})

formatYaml := goyek.Define(goyek.Task{
Name: "format-yaml",
Usage: "Formats YAML code.",
Parallel: true,
Action: func(a *goyek.A) {
cmd.Exec(a, fmt.Sprintf("go run github.com/wasilibs/go-prettier/cmd/prettier@%s --no-error-on-unmatched-pattern --write '**/*.yaml' '**/*.yml'", verGoPrettier))
},
})

goyek.Define(goyek.Task{
Name: "format",
Usage: "Format code in various languages.",
Deps: append(goyek.Deps{formatGo}, formatTasks...),
Deps: append(goyek.Deps{formatGo, formatMarkdown, formatYaml}, formatTasks...),
})

goyek.Define(goyek.Task{
Expand All @@ -43,25 +62,37 @@ func DefineTasks(opts ...Option) {
})

lintGo := goyek.Define(goyek.Task{
Name: "lint-go",
Usage: "Lints Go code.",
Name: "lint-go",
Usage: "Lints Go code.",
Parallel: true,
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))
},
})

lintMarkdown := goyek.Define(goyek.Task{
Name: "lint-markdown",
Usage: "Lints Markdown code.",
Parallel: true,
Action: func(a *goyek.A) {
cmd.Exec(a, fmt.Sprintf("go run github.com/wasilibs/go-prettier/cmd/prettier@%s --no-error-on-unmatched-pattern --check '**/*.md'", verGoPrettier))
},
})

lintYaml := goyek.Define(goyek.Task{
Name: "lint-yaml",
Usage: "Lints Yaml code.",
Name: "lint-yaml",
Usage: "Lints YAML code.",
Parallel: true,
Action: func(a *goyek.A) {
cmd.Exec(a, fmt.Sprintf("go run github.com/wasilibs/go-prettier/cmd/prettier@%s --no-error-on-unmatched-pattern --check '**/*.yaml' '**/*.yml'", verGoPrettier))
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: append(goyek.Deps{lintGo, lintYaml}, lintTasks...),
Deps: append(goyek.Deps{lintGo, lintMarkdown, lintYaml}, lintTasks...),
})

test := goyek.Define(goyek.Task{
Expand Down
1 change: 1 addition & 0 deletions versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ const (
verGolangCILint = "v1.58.1"
verGosImports = "v0.3.8"
verGoFumpt = "v0.6.0"
verGoPrettier = "e72150eff8c34a7d10d28fcd932649c95903f1a6"
verGoYamllint = "v1.35.1"
)

0 comments on commit ec40e94

Please sign in to comment.