Fork me on GitHub
#clj-kondo
<
2022-05-26
>
borkdude14:05:04

Here is a demo of the upcoming :warn-on-reflection linter. https://twitter.com/borkdude/status/1529836621918502913 Feedback welcome

šŸ˜ 4
borkdude14:05:45

Merged to master now in case anyone wants to try

borkdude19:05:04

I just pushed a clj-kondo.hooks-api namespace to master which should make it easier to play around with :analyze-call hooks in the JVM REPL. Example:

$ clj
Clojure 1.11.0
user=> (require '[clj-kondo.hooks-api :as api])
nil
user=> (def node (api/parse-string "(+ 1 2 3)"))
#'user/node
user=> (defn my-hook [{:keys [node]}] {:node (api/list-node (list* (rest (:children node))))})
#'user/my-hook
user=> (str (:node (my-hook {:node node})))
"(1 2 3)"
cc @lee

ā¤ļø 2
Noah Bogart22:05:58

Oh hell yeah, this is gonna be so helpful!

borkdude19:05:08

āž”ļø šŸšØ I plan to do a new clj-kondo release tomorrow morning. Please give master a spin if you're able to. šŸšØ ā¬…ļø

wilkerlucio20:05:05

hello, I'm trying to figure how to generate the kondo analisys, but having a hard time to find an example

wilkerlucio21:05:04

I tried to change my config but I can't see the output file, I think a complete example would be very helpful

wilkerlucio21:05:06

I have questions like: ā€¢ what command will make the output be generated, its just clj-kondo --lint ...? ā€¢ where the output file is going to be? what is its name?

wilkerlucio21:05:53

oh, sorry, scrolling down I'm starting to see more complete examples, I was in a pairing session and for some reason I missed it facepalm

borkdude21:05:35

yeah, so the output is always spit out as data, never to a file

borkdude21:05:54

and you have to select either :format :edn or :format :json on the command line

borkdude21:05:26

A basic example:

$ clj-kondo --config '{:analysis true :output {:format :edn}}' --lint - <<< '(inc 1)'
{:findings [], :summary {:error 0, :warning 0, :info 0, :type :summary, :duration 36, :files 1}, :analysis {:namespace-definitions [], :namespace-usages [], :var-definitions [], :var-usages [{:fixed-arities #{1}, :end-row 1, :name-end-col 5, :name-end-row 1, :name-row 1, :name inc, :filename "<stdin>", :from user, :col 1, :name-col 2, :end-col 8, :arity 1, :row 1, :to clojure.core}]}}

wilkerlucio21:05:30

I'm trying on a project, but getting blank results:

wilkerlucio21:05:31

clj-kondo --lint src --config '{:output {:format :edn}, :analysis true}'
{:findings [], :summary {:error 0, :warning 0, :info 0, :type :summary, :duration 220, :files 26}}

wilkerlucio21:05:36

(also got blank on your example here, trying to bump clj-kondo to see if that fixes it)

wilkerlucio21:05:52

clj-kondo --config '{:analysis true :output {:format :edn}}' --lint - <<< '(inc 1)'
{:findings [], :summary {:error 0, :warning 0, :info 0, :type :summary, :duration 10, :files 1}}

wilkerlucio21:05:36

bumped to latest, still seeing blank results

borkdude21:05:52

in the previous release, put the :analysis section inside the :output

borkdude21:05:03

the master version (will be released tomorrow) supports both

wilkerlucio21:05:23

ah, that works! šŸ˜„

wilkerlucio21:05:44

thanks @U04V15CAJ šŸ™

šŸ‘ 1