Skip to content

Manage all your code quality tools with a single executable

Notifications You must be signed in to change notification settings

twelvelabs/stylist

Repository files navigation

Stylist

build codecov

Stylist aggregates all your code quality tools into a single, fast, and easy to use executable. You define the tools your project uses in .stylist.yml:

---
# A "processor" is a code quality tool (linter, scanner, formatter, etc...)
processors:

  ############################################################
  # Stylist comes with presets for many common tools...
  ############################################################

  - preset: cspell
    includes:
      - "**/*"
    excludes:
      - "problem-file1.txt"
      - "problem-file2.txt"

  - preset: gofmt
    includes:
      - "**/*.go"

  - preset: golangci-lint
    includes:
      - "**/*.go"
    excludes:
      - "gen/*"

  - preset: markdownlint
    includes:
      - "**/*.md"

  ############################################################
  # ... or you can provide custom configuration.
  ############################################################

  - name: custom-tool
    includes:
      - "**/*.{ext1,ext2,ext3}"
    # Processors define check and/or fix commands
    # (check commands report issues, fix commands correct them).
    # See the documentation for more detail.
    check:
      command: "custom-tool lint --output=sarif"
      input: variadic
      output: stdout
      format: sarif
    fix:
      command: "custom-tool lint --auto-fix --output=sarif"
      input: variadic
      output: stdout
      format: sarif

Then run stylist's check and fix commands:

$ stylist check
[cspell] main.go:8:16 Unknown word 'someFunc' (spelling)
[golangci-lint] main.go:8:16 Error return value of `someFunc` is not checked (errcheck)
[markdownlint] README.md:1:9 Trailing punctuation in heading [Punctuation: ':'] (MD026)
[markdownlint] README.md:3:81 Line length [Expected: 80; Actual: 153] (MD013)

$ stylist fix
[markdownlint] README.md

Installation

Using Homebrew

brew install twelvelabs/tap/stylist

Pre-built binary

Download a pre-built binary from the Releases page.

From source

go install "github.com/twelvelabs/stylist@latest"
# or a specific version tag
tag=$(gh release view --json tagName --jq .tagName)
go install "github.com/twelvelabs/stylist@${tag}"