https://github.com/nnichols/clojure-lint-action
A GitHub Action that lints clojure files with clj-kondo and generates comments with reviewdog on pull requests to improve the code review experience.
https://github.com/nnichols/clojure-lint-action
action clojure github-actions kondo lint linter
Last synced: about 1 month ago
JSON representation
A GitHub Action that lints clojure files with clj-kondo and generates comments with reviewdog on pull requests to improve the code review experience.
- Host: GitHub
- URL: https://github.com/nnichols/clojure-lint-action
- Owner: nnichols
- License: mit
- Created: 2021-07-07T19:13:37.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2025-01-03T22:16:36.000Z (5 months ago)
- Last Synced: 2025-04-27T05:49:05.620Z (about 1 month ago)
- Topics: action, clojure, github-actions, kondo, lint, linter
- Language: Shell
- Homepage:
- Size: 22.5 KB
- Stars: 21
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Clojure Lint Action
A GitHub Action to lint clojure files with [clj-kondo](https://github.com/clj-kondo/clj-kondo) and [reviewdog](https://github.com/reviewdog/reviewdog) on pull requests to improve the code review experience.

## Example Usage
The clojure-lint-action is used in almost every Wall Brew repository.
If you'd like to see a sample GitHub workflow using this linter, please check out [spoon](https://github.com/Wall-Brew-Co/spoon/blob/1ec5a26e49561f6c653bbba666a024a9924cf831/.github/workflows/lint.yml#L33 "An example workflow file using this action.")
That action was used as a CI/CD check in this [Pull Request.](https://github.com/Wall-Brew-Co/spoon/pull/14 "An example PR with 2 linter warnings written as comments")## Inputs
### `github_token`
Optional.
`${{ github.token }}` is used by default.### `level`
Optional.
Report level for reviewdog- must be one of `[info, warning, error]`.
It's same as `-level` flag of reviewdog.### `reporter`
Reporter of reviewdog command.
Must be one of `[github-pr-check, github-pr-review, github-check]`.
Default is github-pr-check.
github-pr-review can use Markdown and add a link to rule page in reviewdog reports.### `filter_mode`
Optional.
Filtering mode for the reviewdog command.
Must be one of `[added, diff_context, file, nofilter]`.
Default is added.### `fail_on_error`
Optional.
Sets and exceptional exit code for reviewdog when errors are found.
Must be one of `[true, false]`.
Default is `false`.### `reviewdog_flags`
Optional.
Additional reviewdog flags.### `path`
Optional.
Base directory to run clj-kondo.
Same as `[path]` of `find` command.
Default: `.`### `pattern`
Optional.
File patterns of target files.
Same as `-name [pattern]` of `find` command.
Default: `*.clj*` (To capture `*.clj`, `*.cljs`, `*.cljc`, and `*.cljx`)### `exclude`
Optional.
Exclude patterns of target files.
Same as `-not -path [exclude]` of `find` command.
e.g. `./git/*`### `clj_kondo_config`
Optional.
Flags to pass to clj-kondo's `--config` option, which may either be in-line options or a path to a config file.
Default: `'{:output {:pattern "{{filename}}:{{row}}:{{col}}: {{message}}"}}'`## Example usage
### [.github/workflows/reviewdog.yml](.github/workflows/reviewdog.yml)
To receive automatic Pull Request comments with linter results:
```yml
name: Lint Clojure
on: [pull_request]
jobs:
clj-kondo:
name: runner / clj-kondo
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: clj-kondo
uses: nnichols/clojure-lint-action@v2
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
```## Licensing
Copyright © [Nick Nichols](https://nnichols.github.io/)
Distributed under the [MIT License](https://github.com/nnichols/clojure-lint-action/blob/master/LICENSE)