Fork me on GitHub
#clj-kondo
<
2022-04-08
>
Jakub Holý (HolyJak)10:04:11

Hi! Is it possible to tell kondo to fail on :deprecated-var in prod code but to ignore it in test code?

borkdude10:04:11

@holyjak You could lint your production code separately from your test code for now, or put a namespace metadata config in the test code.

borkdude10:04:24

There is also a configuration to ignore certain deprecated vars in certain namespaces

borkdude10:04:26

see linters.md

Jakub Holý (HolyJak)11:04:09

Awesome, thanks! > put a namespace metadata config in the test code. Where is that documented? I looked at disabling linters here https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#options but do not see it

borkdude11:04:38

(ns foo {:clj-kondo/config '{:linters ...}})

borkdude12:04:12

clj-kondo v2022.04.08https://github.com/clj-kondo/clj-kondo/issues/1331: new linter :non-arg-vec-return-type-hint that warns when a return type hint is not placed on the arg vector (CLJ only). See https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md#non-arg-vec-return-type-hint. • Enable :namespace-name-mismatch by default • https://github.com/clj-kondo/clj-kondo/pull/1611: support ^:replace override for nested config values • https://github.com/clj-kondo/clj-kondo/issues/1625: Add option --skip-lint, to skip linting while still executing other tasks like copying configuration with --copy-configs. • https://github.com/clj-kondo/clj-kondo/issues/1620: return type too narrow for re-find Analysis: • https://github.com/clj-kondo/clj-kondo/issues/1623: Implement analysis for Java classes: :java-class-definitions and :java-class-usages. See https://github.com/clj-kondo/clj-kondo/blob/master/analysis/README.md. • https://github.com/clj-kondo/clj-kondo/pull/1635: add :end-row and end-col to analyze data for :namespace-definitionshttps://github.com/clj-kondo/clj-kondo/issues/1651: Improvements for :protocol-implshttps://github.com/clj-kondo/clj-kondo/issues/1612: Improve analysis for deftypehttps://github.com/clj-kondo/clj-kondo/issues/1613: Improve analysis for reifyhttps://github.com/clj-kondo/clj-kondo/issues/1609: keyword analysis for ns + require channel: #clj-kondo

imre13:04:07

With new linters being regularly added, how do you decide whether to promote something to the warning or error level?

borkdude13:04:11

• For subjective/style things: level :off • Experimental: level :off until further notice • Causes compilation error: level :error • Not wrong, but can cause damage: level :warning

borkdude13:04:14

something like that

imre14:04:02

Thank you. Just trying to think about a good process of keeping up with all the new rules.

Noah Bogart15:04:18

I've opened an issue for keywords in :keys binding vectors (https://github.com/clj-kondo/clj-kondo/issues/1653). There was some chatter about this when I posted about it in February before I went on leave, so seems relevant to bring it up now that I've made the issue.

borkdude15:04:16

I'm fine with someone implementing that as a stylistic thing which is disabled by default

borkdude15:04:35

I don't see an urgent need for that check myself and will probably not use it

borkdude15:04:26

so ... PR welcome! :)

borkdude19:04:11

Thanks! I'll take a look soon

Noah Bogart19:04:39

take your time simple_smile

Noah Bogart15:04:52

an off-by-default stylistic lint is totally cool with me. Thanks!

nonrecursive19:04:10

hey y’all, I’m having trouble finding docs on an issue. clj-kondo doesn’t appear to be picking up .clj-kondo/config.edn in the deps for a project I’m working on. How would I configure this?

borkdude19:04:00

Have you tried from the command line?

borkdude19:04:30

maybe try that first

Joshua Suskalo19:04:15

My first thought with that description of the issue is that your editor is running kondo from the wrong directory.

Joshua Suskalo19:04:31

If it works from the commandline that makes this theory very likely.

borkdude19:04:33

That's why I'm asking that first :)

borkdude19:04:48

Let's get the editor out of the equation first

borkdude19:04:58

Could also be an error in the config file

nonrecursive19:04:41

ok I ran

clj-kondo --lint "$(clojure -Spath)" --dependencies --parallel --copy-configs
and then linted a specific file with
clj-kondo --lint src/donut/todo_example/frontend/components/todo_list.cljs
and it’s still showing errors and warnings

nonrecursive19:04:04

i don’t really use it from the command line so i’m probably doing something wrong? 🙂

borkdude19:04:07

> and it’s still showing errors and warnings so that works right?

nonrecursive19:04:55

sorry, it’s showing errors and warnings, indicating that it’s not loading the .clj-kondo/config.edn files from dependencies

nonrecursive19:04:19

there shouldn’t be any errors

borkdude19:04:53

oh, now I get it. clj-kondo does not load .clj-kondo/config.edn from dependencies. when you run with --copy-configs it copies configs from clj-kondo.exports/your-org/your-lib to your .clj-kondo directory

Joshua Suskalo19:04:26

yeah, so dependencies may have kondo configs that they don't export, and may have simplified versions of the configs that they do export to consumers.

👍 1
nonrecursive19:04:05

aaaah ok, got it! thanks. have there been any changes around this recently? Up until yesterday or so it seemed like clj-kondo was loading .clj-kondo/config.edn from deps

borkdude19:04:16

no, it was always like this

borkdude19:04:18

Note that you can include the exported config of a lib within that lib's own config using config-paths

nonrecursive19:04:30

ah ok so if a lib has resources/clj-kondo.exports/clj-kondo/my/lib/config.edn then that lib’s .clj-kondo/config.edn can include it?

borkdude19:04:37

via :config-paths ["../resources/clj-kondo.exports/my/lib"]

borkdude19:04:48

(you don't need the extra clj-kondo in there)

nonrecursive19:04:54

gotcha. thank you! I’ll give that a try

nonrecursive19:04:12

yay it’s working!! thank you :hugging_face: also had to include some -Adev in getting the deps bc my deps.edn needs improvement

Noah Bogart23:04:34

How interested would y'all be in a “turn on all lints and make then errors” lint/flag/setting?

1