Fork me on GitHub

Is it possible to turn off analysis of :var-usages? If not, and that feature were added, could I expect it to speed up analysis? That is, if analysis were limited to :namespace-definitions, :namespace-usages, and :var-definitions, would it be much faster, or is analysis more dominated by other things like parsing the file?


@jacob.maine You could test that by manually disabling. I expect it not to matter much


What is the context of the question, clojure-lsp?


But does kondo already support disable only var-usages?


Ah, so it can already be disabled? Cool. I’ll try that. Yes, I’m asking for clojure-lsp. I’m contemplating a different startup strategy. The strategy would improve startup time in large projects and on initial load of new projects. Instead of doing a full analysis of the whole project and all its deps, we would only analyze the open files. That would work better if we could also analyze files one step away (required namespaces, or namespaces that require the open namespace), which we’d need to do an initial analysis of :namespace-definitions and :namespace-usages for. By itself, with a little bit of clever caching and on-demand analysis, that’d give us enough information to support must clojure-lsp features. There are a few more we could support if the initial analysis included :var-definitions


> Ah, so it can already be disabled? No I meant, testing it by disabling it manually in the code


i guess i should phrase my question slightly differently… if we could skip analysis of def and defn bodies (except to get var names, and maybe arglists and other metadata), would you expect that to speed up analysis?


potentially yes. there might be some unexpected interactions with hooks though, I think those should be always fully expanded first and then the bodies could be ignored after those


again you can try this out by manually disabling some code and see the difference


ok, thanks. i’ll try it sometime. obviously short-circuiting would omit vars defined within another defn, and other such monstrosities, but i think we could live with that.

👍 1