Fork me on GitHub
#clj-kondo
<
2022-09-16
>
borkdude17:09:36

A bikeshed for y'all: What would be a good name for a linter that checks if a var (referenced via symbol) already has an alias?

(require '[clojure.string :as str[)
clojure.string/join ;; Namespace clojure.string has alias: str
The PR is ready but the name is something that might need improvement. We started with :existing-alias but I wanted var or symbol in the name since we will have a similar linter for keywords. So now we have :aliased-namespace-symbol (indicating that the namespace of the symbol has an alias) I think we could do better though. This is where you come in!

Darin Douglass18:09:59

:namespace-has-alias? IMO it’s less about keywords / vars and more about the fact that you’ve specified a fully-qualified namespace when you’ve already aliased it before

lread18:09:16

:use-ns-alias-on-symbol recommends the action that should be taken… but maybe you wan’t to describe the problem? :not-using-ns-alias-on-symbol Or maybe you a hint? :ns-alias-available

Darin Douglass18:09:30

i like that last one

lread18:09:06

Yours is good too @U02EA2T7FEH!

Noah Bogart18:09:16

i like when the the linters have "positive" names, action or rule. i don't like when the name has "no" or "don't" or "not" in the same, cuz it makes it harder to know how to configure it to make it work correctly

sheluchin18:09:12

:unused-ns-symbol-alias I'm not sure I see the value in using a different linter message for keyword and symbol aliases.

sheluchin18:09:23

I like :ns-alias-available. Maybe :ns-alias-defined

Noah Bogart19:09:50

i initially thought we didn't need to separate symbols and keywords, but i feel like giving folks more control of granularity is good

👍 1
borkdude19:09:36

Hmm yes, :symbol-ns-alias-defined and :keyword-ns-alias-defined maybe?

sheluchin19:09:24

Those work. I guess a different message for both would at least simplify things for implementing the cycle action for https://github.com/clojure-lsp/clojure-lsp/issues/1128 and its symbol counterpart.

👍 1
skylize20:09:23

symbol-quailfied-without-existing-alias

borkdude20:09:45

:alias-eligible-symbol and :alias-eligible-keyword ;)

borkdude20:09:42

^ I kinda like those

Darin Douglass20:09:44

alias there reads more like a verb to me than a hyphenated adjective /me inhales deeply in bliss; nothing like some quality bike shedding to end the week

Noah Bogart20:09:28

heh I guess I'll suggest a variation on my original choice:`existing-namespace-alias` . I feel it's short and punchy: "there exists an alias for the namespace referenced here"

lread20:09:12

Oh that’s not a bad point. Could just talk about the namespace and not the keyword or symbol. :namespace-is-aliased if that doesn’t conflict with other linter names.

👍 1
borkdude20:09:46

you could not talk about symbol or keyword, but we want two different linters for those, so you should talk about them :)

borkdude20:09:09

I like :namespace-is-aliased

borkdude20:09:18

or just :aliased-namespace

👍 2
borkdude20:09:58

:aliased-namespace-symbol and :aliased-namespace-keyword then?

skylize20:09:20

:forsaken-symbol-alias :forsaken-keyword-alias

3
borkdude20:09:53

oooh hmmm :)

lread21:09:17

Ok, then maybe something more personalized: :for-the-love-of-pete-there-is-an-alias-for-this-namespace-just-use-it-already-lee

😂 1
borkdude21:09:24

lol, I didn't realize we already have :aliased-namespace-symbol https://clojurians.slack.com/archives/CHY97NXE2/p1663361698943839?thread_ts=1663349616.937209&amp;cid=CHY97NXE2 I guess we'll just keep it like this then :) /cc @UEENNMX0T

😂 2
🎉 2
lread21:09:54

Ladies and gentlemen, a perfect bikeshedding session has come to a close!

👍 1
😂 2
🙌 3
borkdude08:09:19

The bikeshed continues! I'd say the warning for this linter should be on the symbol, not on the "call" (the surrounding list): Right?

borkdude12:09:13

I'll fix that now

skylize12:09:30

It should not even matter if there is a "call".

borkdude12:09:24

That already works for normal symbols

borkdude13:09:06

fixed on master

Noah Bogart22:09:41

Ah heck, putting it on the call itself is obviously the right move, idk why I didn’t do it. Thanks for catching and fixing it.

Noah Bogart19:09:26

I'm using timbre for logging along with the json appender library, and the json appender library requires that the log inputs are formatted a specific way. I wrote a hook (`taoensso.timbre/log`) for timbre's logging functions that works on all of them. Is this part avoidable or am I stuck listing all of them manually?

{:hooks {:analyze-call {
                        taoensso.timbre/debug taoensso.timbre/log
                        taoensso.timbre/error taoensso.timbre/log
                        taoensso.timbre/fatal taoensso.timbre/log
                        taoensso.timbre/info taoensso.timbre/log
                        taoensso.timbre/report taoensso.timbre/log
                        taoensso.timbre/trace taoensso.timbre/log
                        taoensso.timbre/warn taoensso.timbre/log
                        }

borkdude20:09:19

this is not avoidable :)

👍 1