Hello
In a PR review, got asked to amend a :require clause, where each required namespace should be on its own line.
Looking at Clojure Style guide about it:
https://github.com/bbatsov/clojure-style-guide#namespace-segments-limit
Is this something clj-kondo would consider as a built-in style linter, or should it remain a project-local hook?
For example, flag this:
(:require [clojure.string :as str] [foo.bar.baz :as quux]
and not this:
(:require [clojure.string :as str])
ThanksI have the code for the hook, so the question is more: would you consider this as feature I should create a PR for? Thanks
I think this probably more belongs in cljfmt?
But doesn’t cljfmt format the code? I just want this linter to say “Hey that line… yea, yea, that one! It’s a bit off.”
cljfmt not only formats the code, but can also check it
not sure if it has ns-specific things. let's ask @ericdallo how clojure-lsp fixes ns forms
Clojure-lsp manually fixes using rewrite-clj, and has options to requires be in 2 different ways
https://clojure-lsp.io/settings/#ns-inner-blocks-indentation
The thing is, can this just be optional, so that the users can turn on/off? Because if you add it to the project, which is large and it didn’t have this on… it can get noisy.
I agree this could be a linter yes, what we do in nubank and other places is to run clojure-lsp diagnostics + clojure-lsp clean-ns which will report if the ns is not following the standard, so having this as a linter would help with having that built-in in diagnostics
So is this worth adding to clj-kondo, seeing as that is being used for the project I’m on? Thanks
I'm not directly opposed, I'm just a bit worried that this will lead to formatting-related linters for all kinds of macros which then eventually will turn into what cljfmt already is
that's true as well, but cljfmt doesn't have the concept of diagnostic, so for me the best place for this is kondo for specifically this one
we could have a clojure-lsp built-in linter as well, but since this doesn't depend on anything from project, clj-kondo would fit best
alright PR welcome
The PR is here: https://github.com/clj-kondo/clj-kondo/pull/2834 forgot to update the thread, thanks
I saw it, but I'm swamped with bb conf and DCD this week/end so I'll look at it later. thanks!
All good, no rush, thank you