Fork me on GitHub
#clj-kondo
<
2020-01-03
>
robert-stuttaford11:01:20

is it possible to make clj-kondo ignore (comment) forms entirely?

borkdude11:01:33

@robert-stuttaford what are things that you would like to have ignored from comment forms? I usually want comment forms (= example code) to be free of errors as well

robert-stuttaford11:01:18

if i can switch off through configuration, then i can produce a report of all linting errors in production code. means it's possible to have 100% clean CI report and not be concerned with developer-time comments at all

robert-stuttaford11:01:52

i also like it on for comments, i use it that way a lot!

robert-stuttaford11:01:54

if i can have that, and figure out a way to lint rum components (i want this enough to contribute it), then we basically have a perfect workflow here!

borkdude11:01:03

can you try :skip-comments true?

robert-stuttaford11:01:21

that did something; i got less output than before. digging deeper...

robert-stuttaford11:01:08

yeah that seems to be working great!

borkdude12:01:17

I kinda forgot about that config.. nice that it's still working 🙂

robert-stuttaford12:01:14

thank you sir. also, carve is -ing fantaaaaaastic 👏

borkdude12:01:11

so then you can do {:lint-as {rum/def-foo clj-kondo.lint-as-macros/defn-1}}

borkdude12:01:21

that would work for a lot of weird def macros

robert-stuttaford12:01:14

it's certainly worth a try! i'd be totally ok with clj-kondo ignoring the rum mixins and just providing the usual linting for the args and body. the issue of course is instructing clj-kondo where the args can be found, and where the body starts!

borkdude12:01:01

the idea of that issue is to completely ignore the bindings, just registering the fact that is defines a var, so you won't get an unresolved symbol warning

borkdude12:01:26

that seems to cover the most weird def-macros that aren't natively supported yet

mhjort13:01:34

Has someone already find out what is required clj-kondo configuration for making compojure-api work with clj-kondo? Macros like this cause issues: https://github.com/metosin/compojure-api/blob/master/src/compojure/api/core.clj#L60

mhjort13:01:57

These macros are used like this (POST "/" request (handle-certificate-request request)). clj-kondo will then generate following error: error: unresolved symbol request

borkdude13:01:24

@mhjort there is built-in support for compojure.core; maybe you can use :lint-as?

mhjort13:01:40

Thanks! I used same kind of :lint-asand :exclude for compojure-api macros. That helped

juhoteperi13:01:43

Compojure support works for basic cases but won't support Compojure-api restructure binding forms like (GET "/:id" req :path-params [id :- s/Str] ...)

borkdude13:01:25

in that case might just want to use :excludeyes

juhoteperi13:01:59

Reitit code will be easier to lint as it is just data 🙂

👍 8
robert-stuttaford14:01:12

why does it say redundant form for #(do (prn %) (something %)) ? pointing at #( . i guess it's because #(do ...) becomes (fn [] (do ...)) ...

dominicm15:01:30

Fwiw, I would consider that bad style.

borkdude14:01:30

@robert-stuttaford that's probably joker? may I refer you to #joker for that?

$ clj-kondo --lint - <<<  '#(do (prn %) (something %))'
<stdin>:1:15: error: unresolved symbol something
linting took 42ms, errors: 1, warnings: 0
$ /usr/local/bin/joker --lint - <<<  '#(do (prn %) (something %))'
<stdin>:1:15: Parse error: Unable to resolve symbol: something
<stdin>:1:2: Parse warning: redundant do form

robert-stuttaford14:01:28

apologies, hard to tell where it's coming from!

robert-stuttaford14:01:44

you must get that a lot heh

borkdude14:01:53

not really, mostly from you 😉

borkdude14:01:05

no worries, I was only kidding, just to be clear 😉

robert-stuttaford14:01:37

haha i'm not fazed. having a blast linting me codes