Metadata-Version: 2.5
Name: stylebook
Version: 0.3.1
Summary: Comprehensive linter aggregator for data and tooling formats
Project-URL: Source Code, https://github.com/hanggrian/stylebook
Project-URL: Bug Tracker, https://github.com/hanggrian/stylebook/issues
Author-email: Hendra Anggrian <hanggrian@proton.me>
License: Apache-2.0
Keywords: lint,linter,sql,toml,yaml
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.12
Requires-Dist: colorama
Requires-Dist: pyyaml==6.0.3
Provides-Extra: ansible-lint
Requires-Dist: ansible-core==2.22.0rc1; (python_version >= '3.15') and extra == 'ansible-lint'
Requires-Dist: ansible-lint==26.10.1; extra == 'ansible-lint'
Provides-Extra: blinter
Requires-Dist: blinter==1.1.42; extra == 'blinter'
Provides-Extra: cfn-lint
Requires-Dist: cfn-lint==1.57.2; extra == 'cfn-lint'
Provides-Extra: dotenv-linter
Requires-Dist: dotenv-linter==0.9.0; extra == 'dotenv-linter'
Provides-Extra: pyinilint
Requires-Dist: pyinilint==0.17; extra == 'pyinilint'
Provides-Extra: restructuredtext-lint
Requires-Dist: restructuredtext-lint==2.0.2; extra == 'restructuredtext-lint'
Provides-Extra: sqlfluff
Requires-Dist: sqlfluff==4.4.0; extra == 'sqlfluff'
Provides-Extra: taplo
Requires-Dist: taplo==0.9.3; extra == 'taplo'
Provides-Extra: yamllint
Requires-Dist: yamllint==1.38.0; extra == 'yamllint'
Description-Content-Type: text/markdown

[![GitHub Actions](https://shields.io/github/actions/workflow/status/hanggrian/stylebook/code-analysis.yaml)](https://github.com/hanggrian/stylebook/actions/workflows/code-analysis.yaml)
[![Codecov](https://shields.io/codecov/c/gh/hanggrian/stylebook)](https://app.codecov.io/gh/hanggrian/stylebook/)
[![Renovate](https://shields.io/badge/renovate-enabled-brightgreen)](https://developer.mend.io/github/hanggrian/stylebook/)\
[![GitHub Release](https://shields.io/github/release/hanggrian/stylebook)](https://pkg.go.dev/github.com/hanggrian/stylebook/)
[![PyPI](https://shields.io/pypi/v/stylebook)](https://pypi.org/project/stylebook/)
[![TestPyPI](https://shields.io/pypi/v/stylebook?label=testpypi&pypiBaseUrl=https://test.pypi.org)](https://test.pypi.org/project/stylebook/)
[![NPM](https://shields.io/npm/v/@hanggrian/stylebook)](https://npmjs.com/package/@hanggrian/stylebook/)\
[![Go](https://shields.io/github/go-mod/go-version/hanggrian/stylebook)](https://go.dev/doc/go1.26/)
[![Python](https://shields.io/badge/python-3.10+-informational)](https://docs.python.org/3.10/)
[![Node](https://shields.io/badge/node-12+-informational)](https://nodejs.org/en/blog/release/v12.0.0/)

# Stylebook

![The Stylebook logo.](https://github.com/hanggrian/stylebook/raw/assets/logo.svg)

Linter aggregator for various data formats. All linters are preconfigured with
common rules like duplicate blank lines, trailing whitespace and consistent
indentation. In Markdown, it has third-party rules to check dead links and
broken images.

<table>
  <thead>
    <tr>
      <th>Runner</th>
      <th>File type</th>
      <th>Linter</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td rowspan="12">Go</td>
      <td>CSV</td>
      <td>
        <a href="https://github.com/Clever/csvlint/">
          csvlint
        </a>
        with<br>
        <a href="https://www.rfc-editor.org/rfc/rfc4180.html">
          RFC 4180
        </a>
      </td>
    </tr>
    <tr>
      <td>Dockerfile</td>
      <td>
        <a href="https://github.com/hadolint/hadolint/">
          Hadolint
        </a>
        with<br>
        <a href="https://docs.docker.com/build/building/best-practices/">
          Docker Build Best Practices
        </a>
      </td>
    </tr>
    <tr>
      <td>GitHub Actions</td>
      <td>
        <a href="https://github.com/rhysd/actionlint/">
          actionlint
        </a>
      </td>
    </tr>
    <tr>
      <td>Go Module</td>
      <td>
        <a href="https://github.com/ldez/gomoddirectives/">
          gomoddirectives
        </a>
      </td>
    </tr>
    <tr>
      <td>Kubernetes</td>
      <td>
        <a href="https://github.com/stackrox/kube-linter/">
          kube-linter
        </a>
      </td>
    </tr>
    <tr>
      <td>LaTeX</td>
      <td>
        <a href="https://cgit.git.savannah.nongnu.org/cgit/chktex.git">
          ChkTeX
        </a>
      </td>
    </tr>
    <tr>
      <td>Makefile</td>
      <td>
        <a href="https://github.com/checkmake/checkmake/">
          checkmake
        </a>
      </td>
    </tr>
    <tr>
      <td>Properties</td>
      <td>
        <a href="https://github.com/hanggrian/propertieslint/">
          propertieslint
        </a>
      </td>
    </tr>
    <tr>
      <td>Protobuf</td>
      <td>
        <a href="https://github.com/yoheimuta/protolint/">
          protolint
        </a>
        with<br>
        <a href="https://protobuf.dev/programming-guides/style/">
          Protobuf Style Guide
        </a>
      </td>
    </tr>
    <tr>
      <td>Shell</td>
      <td>
        <a href="https://github.com/koalaman/shellcheck/">
          ShellCheck
        </a>
      </td>
    </tr>
    <tr>
      <td>Terraform</td>
      <td>
        <a href="https://github.com/terraform-linters/tflint/">
          TFLint
        </a>
        with<br>
        <a href="https://developer.hashicorp.com/terraform/language/style/">
          Terraform Style Guide
        </a>
      </td>
    </tr>
    <tr>
      <td>XML</td>
      <td>
        <a href="https://github.com/GNOME/libxml2/tree/master/">
          libxml2
        </a>
      </td>
    </tr>
    <tr>
      <td rowspan="10">Python</td>
      <td>Ansible</td>
      <td>
        <a href="https://github.com/ansible/ansible-lint/">
          ansible-lint
        </a>
      </td>
    </tr>
    <tr>
      <td>AsciiDoc</td>
      <td>
        <a href="https://github.com/docToolchain/asciidoc-linter/">
          AsciiDoc-Linter
        </a>
      </td>
    </tr>
    <tr>
      <td>AWS CloudFormation</td>
      <td>
        <a href="https://github.com/aws-cloudformation/cfn-lint/">
          CloudFormation Linter
        </a>
      </td>
    </tr>
    <tr>
      <td>Batch</td>
      <td>
        <a href="https://github.com/tboy1337/Blinter/">
          Blinter
        </a>
      </td>
    </tr>
    <tr>
      <td>Dotenv</td>
      <td>
        <a href="https://github.com/wemake-services/dotenv-linter/">
          dotenv-linter
        </a>
      </td>
    </tr>
    <tr>
      <td>INI</td>
      <td>
        <a href="https://gitlab.com/danieljrmay/pyinilint/">
          PyINILint
        </a>
      </td>
    </tr>
    <tr>
      <td>reStructuredText</td>
      <td>
        <a href="https://github.com/twolfson/restructuredtext-lint/">
          restructuredtext-lint
        </a>
      </td>
    </tr>
    <tr>
      <td>SQL</td>
      <td>
        <a href="https://github.com/sqlfluff/sqlfluff/">
          SQLFluff
        </a>
        with<br>
        <a href="https://docs.telemetry.mozilla.org/concepts/sql_style/">
          Mozilla SQL Style Guide
        </a>
      </td>
    </tr>
    <tr>
      <td>TOML</td>
      <td>
        <a href="https://github.com/tamasfe/taplo/">
          Taplo
        </a>
        with<br>
        <a href="https://toml.io/en/">
          TOML Quick Tour
        </a>
      </td>
    </tr>
    <tr>
      <td>YAML</td>
      <td>
        <a href="https://github.com/adrienverge/yamllint/">
          yamllint
        </a>
        with<br>
        <a href="https://www.yaml.info/learn/bestpractices.html">
          YAML Best Practices
        </a>
      </td>
    </tr>
    <tr>
      <td rowspan="9">Node</td>
      <td>Amazon State Language</td>
      <td>
        <a href="https://github.com/ChristopheBougere/asl-validator/">
          asl-validator
        </a>
      </td>
    </tr>
    <tr>
      <td>CSS</td>
      <td>
        <a href="https://github.com/stylelint/stylelint/">
          Stylelint
        </a>
        with<br>
        <a href="https://protocol.mozilla.org/docs/contributing/css-guide/">
          Mozilla CSS Coding Guide
        </a>
      </td>
    </tr>
    <tr>
      <td>GraphQL</td>
      <td>
        <a href="https://github.com/cjoudrey/graphql-schema-linter/">
          graphql-schema-linter
        </a>
      </td>
    </tr>
    <tr>
      <td>HTML</td>
      <td>
        <a href="https://github.com/htmlhint/HTMLHint/">
          HTMLHint
        </a>
        with<br>
        <a href="https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Code_style_guide/HTML/">
          Mozilla HTML Style Guide
        </a>
      </td>
    </tr>
    <tr>
      <td>JSON</td>
      <td>
        <a href="https://github.com/prantlf/jsonlint/">
          JSON Lint
        </a>
      </td>
    </tr>
    <tr>
      <td>Lockfile</td>
      <td>
        <a href="https://github.com/lirantal/lockfile-lint/">
          lockfile-lint
        </a>
      </td>
    </tr>
    <tr>
      <td>Markdown</td>
      <td>
        <a href="https://github.com/davidanson/markdownlint/">
          markdownlint
        </a>
        with<br>
        <a href="https://experienceleague.adobe.com/en/docs/contributor/contributor-guide/writing-essentials/markdown/">
          Adobe Markdown Basics
        </a>
      </td>
    </tr>
    <tr>
      <td>Mermaid</td>
      <td>
        <a href="https://github.com/probelabs/maid/">
          Maid
        </a>
      </td>
    </tr>
    <tr>
      <td>Tekton</td>
      <td>
        <a href="https://github.com/IBM/tekton-lint/">
          tekton-lint
        </a>
      </td>
    </tr>
  </tbody>
</table>

[View rules](https://hanggrian.github.io/stylebook/rules/)

## Download

Several linters must be installed separatedly, preferably at OS level:

- ChkTeX
- Hadolint
- ShellCheck
- libxml2

### Go

Most linters are brought in as dependencies, others can be installed
selectively.

```sh
go install github.com/hanggrian/stylebook@latest
go install github.com/checkmake/checkmake/cmd/checkmake@latest
go install github.com/terraform-linters/tflint@latest
```

### PyPI

All linters are brought in as optional dependencies, exclude the ones you don't
need.

```sh
pip install "stylebook[ \
  ansible-lint, \
  asciidoc-linter, \
  blinter, \
  cfn-lint, \
  dotenv-linter, \
  pyinilint, \
  sqlfluff, \
  taplo, \
  yamllint, \
  restructuredtext-lint \
]"
```

### NPM

Most linters are brought in as optional dependencies, except for Stylelint,
which needs to be installed in the root `package.json`.

```sh
npm i @hanggrian/stylebook \
  stylelint \
  @stylistic/stylelint-plugin \
  stylelint-config-recommended --save-dev
```

## Usage

<img
  width="480px"
  alt="CLI screenshot"
  src="https://github.com/hanggrian/stylebook/raw/assets/screenshot.png">

Insert target paths into the command. The program will recursively search for
qualifying file types and spawn the corresponding linter processes.

```sh
stylebook . # Go binary
npx @hanggrian/stylebook some-folder/ some-file.sql
source .venv/bin/activate && stylebook **/*
```

### Configuration

Configuration files are automatically picked up. If the file doesn't exist, the
program will use default configuration. If `.stylebookrc` exists in the root
project directory, it will be used as exclusion list.
