clj-kondo
clj-kondo documentation
- Version in MegaLinter: 2022.04.25
- Visit Official Web Site
- See How to configure clj-kondo rules
- If custom
.clj-kondo/config.edn
config file is not found, .clj-kondo/config.edn will be used
- If custom
- See How to disable clj-kondo rules in files
- See Index of problems detected by clj-kondo
Configuration in MegaLinter
- Enable clj-kondo by adding
CLOJURE_CLJ_KONDO
in ENABLE_LINTERS variable - Disable clj-kondo by adding
CLOJURE_CLJ_KONDO
in DISABLE_LINTERS variable
Variable | Description | Default value |
---|---|---|
CLOJURE_CLJ_KONDO_ARGUMENTS | User custom arguments to add in linter CLI call Ex: -s --foo "bar" |
|
CLOJURE_CLJ_KONDO_FILTER_REGEX_INCLUDE | Custom regex including filter Ex: (src\|lib) |
Include every file |
CLOJURE_CLJ_KONDO_FILTER_REGEX_EXCLUDE | Custom regex excluding filter Ex: (test\|examples) |
Exclude no file |
CLOJURE_CLJ_KONDO_CLI_LINT_MODE | Override default CLI lint mode - file : Calls the linter for each file- list_of_files : Call the linter with the list of files as argument- project : Call the linter from the root of the project |
file |
CLOJURE_CLJ_KONDO_FILE_EXTENSIONS | Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all filesEx: [".py", ""] |
[".clj", ".cljs", ".cljc", ".edn"] |
CLOJURE_CLJ_KONDO_FILE_NAMES_REGEX | File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files Ex: ["Dockerfile(-.+)?", "Jenkinsfile"] |
Include every file |
CLOJURE_CLJ_KONDO_PRE_COMMANDS | List of bash commands to run before the linter | None |
CLOJURE_CLJ_KONDO_POST_COMMANDS | List of bash commands to run after the linter | None |
CLOJURE_CLJ_KONDO_CONFIG_FILE | clj-kondo configuration file nameUse LINTER_DEFAULT to let the linter find it |
.clj-kondo/config.edn |
CLOJURE_CLJ_KONDO_RULES_PATH | Path where to find linter configuration file | Workspace folder, then MegaLinter default rules |
CLOJURE_CLJ_KONDO_DISABLE_ERRORS | Run linter but consider errors as warnings | false |
CLOJURE_CLJ_KONDO_DISABLE_ERRORS_IF_LESS_THAN | Maximum number of errors allowed | 0 |
IDE Integration
Use clj-kondo in your favorite IDE to catch errors before MegaLinter !
IDE | Extension Name | Install | |
---|---|---|---|
Atom | linter-kondo | Visit Web Site | |
Emacs | flycheck-clj-kondo | Visit Web Site | |
Visual Studio Code | clj-kondo | ||
Visual Studio Code | Clojure lint | Visit Web Site |
MegaLinter Flavours
This linter is available in the following flavours
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
all | Default MegaLinter Flavor | 101 | ||
java | Optimized for JAVA based projects | 44 |
Behind the scenes
How are identified applicable files
- File extensions:
.clj
,.cljs
,.cljc
,.edn
How the linting is performed
- clj-kondo is called one time by identified file
Example calls
clj-kondo --lint myfile.clj
clj-kondo --lint --config .clj-kondo/config.edn myfile.clj
Help content
clj-kondo v2022.04.25
Options:
--lint <file>: a file can either be a normal file, directory or classpath. In the
case of a directory or classpath, only .clj, .cljs and .cljc will be
processed. Use - as filename for reading from stdin.
--lang <lang>: if lang cannot be derived from the file extension this option will be
used. Supported values: clj, cljs, cljc.
--filename <file>: in case stdin is used for linting, use this to set the
reported filename.
--cache-dir: when this option is provided, the cache will be resolved to this
directory. If --cache is false, this option will be ignored.
--cache: if false, won't use cache. Otherwise, will try to resolve cache
using `--cache-dir`. If `--cache-dir` is not set, cache is resolved using the
nearest `.clj-kondo` directory in the current and parent directories.
--config <config>: config may be a file or an EDN expression. See
https://cljdoc.org/d/clj-kondo/clj-kondo/2022.04.25/doc/configuration
--config-dir <config-dir>: use this config directory instead of auto-detected
.clj-kondo dir.
--parallel: lint sources in parallel.
--dependencies: don't report any findings. Useful for populating cache while linting dependencies.
--copy-configs: copy configs from dependencies while linting.
--skip-lint: skip lint/analysis, still check for other tasks like copy-configs.
--fail-level <level>: minimum severity for exit with error code. Supported values:
warning, error. The default level if unspecified is warning.
--debug: print debug information.
Installation on mega-linter Docker image
- Dockerfile commands :
FROM cljkondo/clj-kondo:2022.04.25-alpine as clj-kondo
COPY --from=clj-kondo /bin/clj-kondo /usr/bin/