One command to run multiple linters under Git version control
Good health is the most important thing. More than success, more than money, more than power.
— Hyman Roth / The Godfather Part II
bosslint.mov
brew install totakke/tap/bosslintOS & arch:
os:- Mac OS -
macos - Linux -
linux
- Mac OS -
arch:- amd64 / x86_64 -
amd64 - aarch64 / arm64 -
aarch64
- amd64 / x86_64 -
Download & install:
curl -sSL https://github.com/totakke/bosslint/releases/download/v0.10.159/bosslint_[os]_[arch] -o bosslint
chmod +x bosslint
mv bosslint [/your/PATH/dir/]To build Bosslint yourself, you must install Clojure CLI tools,
GraalVM and
GraalVM's native-image. Additionally, GRAALVM_HOME environment variable must
be set.
clojure -T:build bin
mv target/bosslint [/your/PATH/dir/]bosslint check command checks changed files between commits, commit and
working tree, etc. with appropriate linters. Arguments of the ref are similar to
git-diff arguments.
$ bosslint check HEAD master
clj-kondo:
linting took 281ms, errors: 0, warnings: 0
==> Success ✅
cljfmt:
All source files formatted correctly
==> Success ✅
eastwood:
...
== Linting done in 1887 ms ==
== Warnings: 0 (not including reflection warnings) Exceptions thrown: 0
==> Success ✅You can use :all to check all files under a Git project.
bosslint check :allYou can use :staged to check only files staged in the Git index (equivalent to
git diff --cached). This is useful for a pre-commit hook.
bosslint check :stagedBosslint just dispatches each linter but does not contain any linters
themselves. You must install each linter preliminarily. Supported linters are
shown by bosslint linters command or are found in
Supported linters section.
Bosslint works well as a Git pre-commit hook. Create .git/hooks/pre-commit
with the following script and make it executable with
chmod +x .git/hooks/pre-commit.
#!/bin/sh
exec bosslint check :stagedbosslint check :staged lints only the files staged in the Git index, so
unstaged changes do not affect the result. The commit is aborted when the
command exits with a non-zero status, i.e., when any linter reports errors or
warnings. To allow warnings and abort only on errors, check the
exit code explicitly.
#!/bin/sh
bosslint check :staged
status=$?
[ $status -eq 2 ] && exit 0
exit $statusUse git commit --no-verify to skip the hook temporarily.
| Linter | Bosslint linter name | Target files |
|---|---|---|
| actionlint | actionlint |
.github/workflows/*.{yaml,yml} |
| ansible-lint | ansible-lint |
**/*.{yaml,yml} |
| Checkstyle | checkstyle |
**/*.java |
| clj-kondo | clj-kondo |
**/*.{clj,cljc,cljs} |
| cljfmt | cljfmt |
**/*.{clj,cljc,cljs} |
| cljstyle | cljstyle |
**/*.{clj,cljc,cljs} |
| commitlint | commitlint |
Commit messages |
| dartanalyzer | dartanalyzer |
**/*.dart |
| Docker Compose Linter | dclint |
**/(docker-)compose.{yaml,yml} |
| dotenv-linter | dotenv-linter |
**/.env |
| Eastwood | eastwood |
**/*.{clj,cljc} |
| Flake8 | flake8 |
**/*.py |
| hadolint | hadolint |
**/Dockerfile |
| jsonlint | jsonlint |
**/*.json |
| kubeval | kubeval |
**/*.{yaml,yml} |
| markdownlint-cli | markdownlint |
**/*.{markdown,md} |
| Ruff | ruff |
**/*.{ipynb,py,pyi} |
| ShellCheck | shellcheck |
**/*.sh |
| sql-lint | sql-lint |
**/*.sql |
| stylelint | stylelint |
**/*.{css,sass,scss} |
| SwiftLint | swiftlint |
**/*.swift |
| tflint | tflint |
**/*.tf |
| yamllint | yamllint |
**/*.{yaml,yml} |
Bosslint implicitly finds and loads a configuration file in the following order.
$XDG_CONFIG_HOME/bosslint/config.edn$HOME/.config/bosslint/config.edn$HOME/.bosslint/config.edn
Alternatively, you can specify a configuration file with --config option.
bosslint check --config path/to/config.edn ref1 ref2The configuration file must be written in Extensible Data Notation (EDN) format, e.g.,
{:clj-kondo
{:disabled? false}
:cljfmt
{:version "0.13.0"
:clojure {:command-options ["--indents" "/path/to/indentation.edn"]}}
:eastwood
{:disabled? true
:version "1.4.3"}}The configuration file has a single map including linter keys and config vals.
All linter config supports :disabled? option (default false). For specific
options to a linter, look at the configuration example.
Exit codes of bosslint check command are based on the results of all executed
linters.
0: no linters output errors and warnings1: one or more linters output errors, or an error occurs in main Bosslint process2: one or more linters output warnings
Copyright © 2020 Toshiki Takeuchi
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.