Fork me on GitHub
#clj-kondo
<
2022-10-06
>
robert-stuttaford05:10:06

please may we also have the clj-kondo bb pod updated to 2022.10.05? 馃槍

robert-stuttaford07:10:16

amazing thank you!

robert-stuttaford07:10:06

fyi, we now bump both the jvm and bb pod at the same time, so there's a +1 to 'number of people needing coordinated releases' for your usage data 馃檪

borkdude07:10:45

I should remember to do this when releasing clj-kondo

robert-stuttaford11:10:33

that's be lovely, yes please 馃槃

andrewzhurov11:10:44

馃憢 is it possible to add #p as an discouraged var.. or rather reader macro?

imre11:10:53

ooh a fellow hashp user! 馃憢:skin-tone-3:

馃檪 1
borkdude11:10:43

currently not, but there is a :config-in-tag option which configures linting behavior in tags. Not sure if this will help in this case, probably not

andrewzhurov11:10:22

loving #p a ton, but occasionally it slips into commits thanks for a prompt reply

imre12:10:33

I know. My secret is that I never add it to the checked-in deps.edn, just keep it in my user-level one so in theory it should fail compilation

鈽濓笍 2
馃憤 1
Noah Bogart13:10:42

How does :redundant-fn-wrapper work? It seems like it only recognizes a predefined set of functions?

noah@cb-dell ~/work
$ echo "(let [as-uuid parse-uuid uuids (map str (range 10))] (map #(as-uuid %) uuids))" | clj-kondo --lint - --config "{:linters {:redundant-fn-wrapper {:level :error}}}" --cache false
linting took 5ms, errors: 0, warnings: 0

borkdude13:10:36

I'm not exactly sure why this case isn't detected

Noah Bogart13:10:45

$ echo "(let [uuids [{:a 1}]] (map #(:a %) uuids))" | clj-kondo --lint - --config "{:linters {:redundant-fn-wrapper {:level :error}}}" --cache false
linting took 8ms, errors: 0, warnings: 0
also with keywords for some reason

borkdude13:10:33

I'd have to look into how it works again, it's been a while

borkdude13:10:49

I also found that in some cases redundant-fn wrappers are still desirable, e.g. for hot reloading

borkdude13:10:55

So I haven't enabled it anymore locally

馃憤 1
borkdude18:10:58

Thanks for the PR. I'm going to check if I can see some interesting new discoveries when I'm running the lint diff

borkdude18:10:16

Sometimes you can discover cases that aren't working properly, so that would be good before merge

Noah Bogart18:10:53

no rush! just something I noticed after cleaning up the existing lint warnings in our production codebase

borkdude18:10:35

< clojure/inspector.clj:120:17: warning: Redundant fn wrapper
3125d3123
< sci/impl/utils.cljc:204:38: warning: Redundant fn wrapper
3367c3365

馃憖 1
Noah Bogart18:10:03

I have a fix for :include-macros bug from github earlier today, but I see that we could be more strict about it than just passing over it. Clojurescript's https://github.com/clojure/clojurescript/blob/a4673b880756531ac5690f7b4721ad76c0810327/src/main/cljs/cljs/core/specs/alpha.cljc#L130 says it only accepts true. Should I convert this fix (that merely discards the form) to a new linter that checks to make sure the option is the literal true?

borkdude18:10:00

Fine with me

馃憤 1
borkdude18:10:14

Also: cljs only

Noah Bogart18:10:29

Right, I'll include that

Noah Bogart18:10:43

Is that something you want to warn about or just skip if in clojure?

Noah Bogart18:10:23

looks like we're not doing such checks for other :require options

borkdude18:10:26

in clojure this is not a valid option

馃憤 1
borkdude18:10:35

so that's an unknown-require-option then

borkdude18:10:32

Perhaps in a .cljc situation it's convenient to leave it in, if it also works for clojure

Noah Bogart18:10:37

I mean that :refer-macros is allowed in clojure, but we could lint it:

$ clj
Clojure 1.11.1
user=> (require '[clojure.string :refer-macros [join]])
nil
user=> (join " " (range 10))
Syntax error compiling at (REPL:1:1).
Unable to resolve symbol: join in this context

Noah Bogart18:10:52

yeah, clojure doesn't care

borkdude18:10:57

Everything is allowed right

馃憤 1
Noah Bogart20:10:23

This works but doesn't feel ideal so let me know how you want to go with it

borkdude21:10:05

To me this feels way too much for simple syntax check, I wouldn't even introduce a new linter for this. Just a warning with type :syntax

馃憤 1
Noah Bogart21:10:50

Oh yeah, I completely forgot about that one. Thanks, I鈥檒l clean it up

Noah Bogart13:10:15

Updated, much simpler now. I included a change to make :unknown-require-option default to :off, which should help everyone out in general