Fork me on GitHub
#clj-kondo
<
2023-01-05
>
Proctor14:01:05

is there a way to mark a form as critical? the opposite of #_:clj-kondo/ignore? e.g. some temp debug stuff that should not be checked in (to trunk at least), and could be nice when I write it to be able to mark it at the same time to have kondo flag it as critical

borkdude15:01:20

Can you make a full example, in order for me to understand better?

jakemcc15:01:00

This is git specific but I use a git pre-commit hook to have a language agnostic way of letting me mark a specific line as "hey, computer don't let me accidentally commit this change" I've written about https://jakemccrary.com/blog/2015/05/31/use-git-pre-commit-hooks-to-stop-unwanted-commits/. It looks like I've slightly tweaked the pre-commit hook since writing that article and the latest version can be found https://github.com/jakemcc/dotfiles/blob/master/git-templates/hooks/pre-commit

Proctor16:01:08

I am doing some println/logging debugging of raw api call results which contain secrets (db credentials, api tokens, etc) when doing local development (because the upstream api looks broken). Since those would be no-nos to have to have in production-like environments in the logs thought maybe marking them as critical might be a way to make sure that those would never creep in

Proctor16:01:02

thinking almost as a hard-lined “TODO” resolution check

Proctor16:01:04

where it makes sense to let it make it into local commits for a working branch, but could be halted by a CI check for getting into trunk

Proctor16:01:47

using CI as being the latest worse case prevention, but even a local check of critical issues when doing final prep for a branch

borkdude16:01:23

@US03ZP2F5 We have discouraged-var for specific forbidden var usages Perhaps you can make an "identity" macro like:

(defmacro dont-do-this [x] x)
and then add this to the discouraged-var linter and wrap calls that should not be used in there

Damien Kick21:01:21

I am writing code that makes use of core.logic in Emacs with clj-kondo doing linting, and it keeps complaining about the binding forms ...

(l/run 3 [q]
    (l/conde
     [(l/== q [[:first "Damien"] [:middle "Robert"] [:last "Kick"]])]
     [(l/== q [[:first "Damien"] [:middle nil] [:last "Kick"]])]
     [(l/== q [[:nickname "D'amy"]])])
    (name!? q))
... gives me ...
dkick1@donovan mallikanren % lein clj-kondo | grep 'Unresolved symbol: q'
/Users/dkick1/src/dkick/mallikanren/src/com/github/dkick/mallikanren/flat/repl.clj:12:13: error: Unresolved symbol: q
dkick1@donovan mallikanren %
These are not typical let-like binding forms because they are not of the form name value but rather only just name. How can I tell clj-kondo stop complaining about unresolved symbols? Thanks

borkdude22:01:39

I think writing a hook for it would be the best option. Then we could maybe host those here: https://github.com/clj-kondo/configs So everyone could use them

borkdude22:01:22

But the quick and dirty way would be to just silence the unresolved var linter for l/run

Ben Lieberman23:01:29

How do I suppress/disable a lint on something like Potemkin's def-derived-map? I know about the :lint-as key in config.edn but I wasn't sure if this was a) the right approach or b) how exactly to do it if it is.

borkdude23:01:57

if you're using clojure-lsp, this importing goes automatically

Ben Lieberman23:01:02

hmm, I am using clojure-lsp. are there any LSP-specific steps I need to take here or no?

borkdude23:01:54

Maybe @UKFSJSM38 can chime in. I’m about to sleep now :)

Ben Lieberman23:01:04

No worries, thank you!

ericdallo23:01:19

clojure-lsp when calling clj-kondo will pass the --copy-configs by default, so you only need something like this in your .clj-kondo/config.edn

{:config-paths ["potemkin/potemkin"]} 

ericdallo23:01:40

This way, clj-kondo will recognize those copied folders and use those configs during linting

Ben Lieberman23:01:52

I added that to my config.edn and now the "quick fix" gives me a drop down menu to tell LSP to lint the selection as one of a number of clojure.core vars, but clicking on any of them does not seem to do anything?

Ben Lieberman23:01:24

I did however put this in my project-level config, should it be in the global clj-kondo config?

Ben Lieberman23:01:12

nvm, got it!

👍 2