The :general lint provider: Clojure COMPILER warnings — reflection and
boxed math.
Unlike clj-kondo (static analysis over source text), these warnings only
exist at COMPILE time: the compiler emits them while it resolves interop /
code. So this provider COMPILES whatever the lint TARGETS — a lint_code code
string, or each source file being linted — in a throwaway namespace that is
torn down afterwards, so the running system is never mutated and nothing leaks.
It compiles the code in a throwaway namespace with *warn-on-reflection* and
*unchecked-math* :warn-on-boxed bound, captures the compiler's *err*
stream, and parses each warning line
Reflection warning, <file>:<row>:<col> - <message>
Boxed math warning, <file>:<row>:<col> - <message>
into the uniform lint finding map, tagged "provider" "general":
{"file" "row" "col" "level" "warning" "type" "reflection"|"boxed-math" "message" "provider" "general"}.
The `:general` lint provider: Clojure COMPILER warnings — reflection and
boxed math.
Unlike clj-kondo (static analysis over source text), these warnings only
exist at COMPILE time: the compiler emits them while it resolves interop /
code. So this provider COMPILES whatever the lint TARGETS — a `lint_code` code
string, or each source file being linted — in a throwaway namespace that is
torn down afterwards, so the running system is never mutated and nothing leaks.
It compiles the code in a throwaway namespace with `*warn-on-reflection*` and
`*unchecked-math* :warn-on-boxed` bound, captures the compiler's `*err*`
stream, and parses each warning line
`Reflection warning, <file>:<row>:<col> - <message>`
`Boxed math warning, <file>:<row>:<col> - <message>`
into the uniform lint finding map, tagged `"provider" "general"`:
`{"file" "row" "col" "level" "warning" "type" "reflection"|"boxed-math"
"message" "provider" "general"}`.(cache-info)Diagnostics for the findings cache: "size", "hits", "misses", and the
current load "generation" — entries recorded under an older one are dead
weight until [[cached]] reaches them.
Diagnostics for the findings cache: `"size"`, `"hits"`, `"misses"`, and the current load `"generation"` — entries recorded under an older one are dead weight until [[cached]] reaches them.
(compile-warnings code)(compile-warnings code file)Compile code (a Clojure source string) with the compiler's reflection and
boxed-math warnings on, and return the parsed findings vector (each tagged
\"provider\" \"general\").
file (optional) is reported as each finding's \"file\" — pass the linted
target (or \"<stdin>\" for a snippet) so these findings group with the
clj-kondo ones.
Unchanged bytes are never compiled twice: findings are cached by content
digest (see [[cache]]) and the reported \"file\" is stamped on afterwards, so
re-linting a project only compiles what actually changed. See
[[compute-findings]] for what one compile does and does not do.
Compile `code` (a Clojure source string) with the compiler's reflection and boxed-math warnings on, and return the parsed findings vector (each tagged `\"provider\" \"general\"`). `file` (optional) is reported as each finding's `\"file\"` — pass the linted target (or `\"<stdin>\"` for a snippet) so these findings group with the clj-kondo ones. Unchanged bytes are never compiled twice: findings are cached by content digest (see [[cache]]) and the reported `\"file\"` is stamped on afterwards, so re-linting a project only compiles what actually changed. See [[compute-findings]] for what one compile does and does not do.
The provider tag every finding from this namespace carries.
The provider tag every finding from this namespace carries.
(reset-cache!)Forget every cached target and zero the counters. Nothing in normal linting needs this — it exists for tests and for a caller that knows the world changed under it.
Forget every cached target and zero the counters. Nothing in normal linting needs this — it exists for tests and for a caller that knows the world changed under it.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |