clj-kondo

Alexsandro Ryan 2024-07-31T14:29:46.063039Z

Hello! I've been testing clj-kondo with the purpose of using it as a SAST tool, so I'm currently verifying if the tool is capable of identifying some special function use cases but then I noticed some behaviors that couldn't get it working, I'll explain below: The scenario is that I'm trying to create a hook that can analyze the received arguments and depending of a certain condition should lint as error or not. The case that I've tried was to check if the first argument of a function is less or equal to the number 5, if so then lint as error, if not then don't lint. The most trivial scenario run smoothly, but then I've tried some other cases like: 1 - Putting the function as a var (did not work). 2 - Putting the argument in a var(did not work. Error: clojure.lang.Symbol cannot be cast to java.lang.Number) Does the library support this? Is there another way to accomplish the same that I'm not using here? Thanks for the help in advance.

Alexsandro Ryan 2024-08-01T13:00:12.248669Z

@borkdude @imre I noticed that will not continue going deeper on this, but thank you for your response!

imre 2024-07-31T15:18:33.383729Z

regarding SAST, note that clojure.core/read-string can https://clojuredocs.org/clojure.core/read-string

👍 1
borkdude 2024-07-31T15:50:28.336449Z

@alexsandrocosta855 I'm not sure what 1 and 2 mean. You could make a github repo with those hooks and example code which gets run, using an example command, like clj-kondo --lint src or so?

borkdude 2024-07-31T15:51:50.673549Z

The name argument in your hook seems to be the name function from clojure core, not a let binding or function argument?