Fork me on GitHub

re i’m still wondering about that switch to control the warning on private tasks. given

 {-a {:doc "private"}
  b {:doc "public"
     :depends [-a]}}}
bb tasks gives
> bb tasks
The following tasks are available:

b public
personally, my main reason for having clj-kondo remind me to provide doc strings is so task info will be available on the shell… :doc being used by babashka for private tasks in any way?


not really no


maybe default to no warning on private tasks then (and leave it at that for the first iteration)

👍 1

@maximilian I think a nice addition could be to actually get linting in the task code.


oh, that’s a nice one


The way this can be done is to wrap the task code as a function with :depends as the arguments


so {:task (+ a b c) :depends [a b c]} becomes (fn [a b c] (+ a b c)) and then lint that function


but this will cause unused function argument warnings... could also expand as (declare a b c) (+ a b c)


will probably have to account for :requires as well


that's closer to how it works in the tasks impl anyways. yes


we can talk in #clj-kondo-dev about this as to not disturb anyone else with details about this


can kondo be configured to not lint library code? e.g:


What editor is this? I need more context than a screenshot.


clj-kondo only lints what you provide to it, so it depends on whatever tool calls clj-kondo


it's vscode + calva, and its really strange because it doesn't happen when first loading up a project


it only happens after being open for 1-2 hours


and then after restarting, it's fine for another hour or two


Are you copying .jar files into your project somehow?


no it's just a project generated with lein new app [name] , zero changes to the structure of the project - not even a new file


I'm not sure why this happens. Have you also tried in #calva or #lsp?


I think this happens indeed, when you open a external dependency the editor loads the content and add the file as a LSP workspace fie, to most navigation and other features work


one of the drawbacks are the lint error


I already faced this with multiple lsps, not only clojure, not sure how we could fix it


maybe don't return diagnostics when the file is external, but the issue is how we know a file is external, need some POC


yeah i asked in #calva and pez recommended asking here, so i'm not really sure where the problem lies. i'm definitely not adding any external dependencies, i don't even know how to do that yet, but i'm not sure if leiningen or calva are adding a dependency or something.


Are you opening core.clj from clojure itself?


external dependencies == opening a file not from your project like clojure.core, clojure.string etc


i'm not opening core.clj at all as far as i know?


I'm out of clues, sorry, clj-kondo is a pretty simple tool: it lints what you tell it to.


yeah, for sure it's not a kondo issue


but not sure it's a calva o lsp one, it's kind of expected this behavior


i don't know clojure at all i'm in the process of trying to learn so i probably can't help as much as i'd like to but here's exactly what i've done: 1. i generated a new project with lein new app clojure-noob 2. i opened the directory it created in vscode 3. i opened a repl 4. the error shows up an hour or two later


it makes sense if it's not a kondo issue but i don't see how this could possibly be expected behaviour?


unless i'm misunderstanding what that means lol


but thank you for your help either way


for sure it's not expected if you didn't open a file, but I think you did at some point


hang on i'm being dumb here, i've only just realised that core.clj is the "main" file so yeah i am opening it


thats the file i'm working in


but these errors and warnings are not corresponding to anything inside the actual file


are you sure? core.clj from your project and core.clj from clojure.core are different file. from your print it seems you opened clojure.core, maybe finding a definition of some function or something


this is the only file i've ever opened since starting to learn clojure in this project:


however you make a good point, maybe this is happening when i hover my mouse over a function and it shows the doc?


it should not, we only lint when we open the file or itś a project file when starting lsp


weird. well, until i figure out exactly what action is making this happen this is probably just wasting your time so i'll just keep an eye on it for now until i figure it out


thank you for your help


no problem, feel free to start with a issue on Calva, the entrypoint, where we can debug and find the root cause


I was just about to ask the same question in this channel.


Because of go to definitions and stuff like that, I often open the clojure.core file, and this brings a lot of clj kondo issues:


Possible to exclude the .m2/ files from linting?

👍 1

I'm having the same problem, but it only started a few days ago, possibly after latest Calva update. The errors are coming from clojure.core, which shouldn't be linted, as I haven't opened. They can be triggered by random changes in my code: deletion of a line, beginning a new form, etc. I have been using Calva for quite a while and first encountered this only a few days ago.


this probably started to happen after we fixed on clojure-lsp the find definition of a jar, I think we can not return lint for jar dependencies, I'll do the proper changes on clojure-lsp side

🙏 1

@U2CR1J4UV @UGC0NEP4Y @UH1SWK753 I just made a linting external files which solve this issue, it should be available on next clojure-lsp release, if you wanna test it locally, you can clone the repo and run make to generate a local clojure-lsp

👍 3