nikoksr/konfetty

View on GitHub
Taskfile.yaml

Summary

Maintainability
Test Coverage
version: "3"

env:
  GO111MODULE: "on"
  GOPROXY: "https://proxy.golang.org,direct"

tasks:
  tools:
    desc: Install tools
    cmds:
      - go install github.com/segmentio/golines@latest
      - go install mvdan.cc/gofumpt@latest
      - go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
      - go install github.com/daixiang0/gci@latest

  setup:
    desc: Setup dev environment
    cmds:
      - go mod tidy

  fmt:
    desc: Format the code
    cmds:
      - golines --shorten-comments -m 120 -w .
      - gofumpt -w -l .
      - gci write -s standard -s default -s "prefix(github.com/nikoksr/konfetty)" .

  lint:
    desc: Lint the code with golangci-lint
    cmds:
      - golangci-lint run ./...

  test:
    desc: Run tests
    cmds:
      - go build ./...
      - go test -failfast -race ./...

  ci:
    desc: Run CI checks
    cmds:
      - task fmt
      - task lint
      - task test

  gen-coverage:
    desc: Generate coverage report
    cmds:
      - go test -race -covermode=atomic -coverprofile=coverage.out ./... > /dev/null

  coverage-html:
    desc: Generate coverage report and open it in the browser
    cmds:
      - task gen-coverage
      - go tool cover -html=coverage.out -o cover.html

  help:
    desc: Show help
    cmds:
      - task --list

  default:
    desc: Show help
    cmds:
      - task help