Problem
Currently, users and orgs create custom linters via clj-kondo hooks, which is a feature that you teach clj-kondo how a macro behaves, giving the option to register diagnostics during this stage, this already limits us in some ways:
- Clj-kondo hooks API only provide context about the current namespace, so we can’t have custom linters that are aware of multiple files or namespaces, since clj-kondo doesn’t have awareness of a project, only a file.
- For complex custom linters where we just want to add additional behavior to an existing function, we need to use the hooks even if the function is already understood correctly by clj-kondo, kind of messing the purpose of the hooks, especially if we want to add multiple custom linters that need to live under the same hook, like schema.core/defn.
- Some orgs like Nubank, already created > 10 custom linters and can have no metrics of how much time those add to diagnostics feature of clojure-lsp, affecting developer IDE experience time + lint task time on PRs.
clojure-lsp already have all project analysis + extra information like deps hierarchy, classpath and others which could enhance to create more complex linters.
So we can say that current linters are file only linters while we want to support project linters.
Example of custom linters
Each project or org can create their custom linters for their own needs, but to give visibility of what a project awareness can do, here are some examples:
- Ensure public logic/adapter functions have unit tests for a org codebase
- Ensure there are integration tests for a service HTTP endpoints
- Ensure use of a arch of a service (not only ns layers but functions usage across namespaces)
Problem
Currently, users and orgs create custom linters via clj-kondo hooks, which is a feature that you teach clj-kondo how a macro behaves, giving the option to register diagnostics during this stage, this already limits us in some ways:
clojure-lsp already have all project analysis + extra information like deps hierarchy, classpath and others which could enhance to create more complex linters.
So we can say that current linters are file only linters while we want to support project linters.
Example of custom linters
Each project or org can create their custom linters for their own needs, but to give visibility of what a project awareness can do, here are some examples: