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"}`.(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. Compilation is the point (this runs only over code we
execute), but it happens in a throwaway namespace and every namespace the
code creates is removed afterwards. A hard compile error yields whatever
warnings were emitted before it (possibly none) — never throws.
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. Compilation is the point (this runs only over code we execute), but it happens in a throwaway namespace and every namespace the code creates is removed afterwards. A hard compile error yields whatever warnings were emitted before it (possibly none) — never throws.
The provider tag every finding from this namespace carries.
The provider tag every finding from this namespace carries.
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 |