When linting a project using a command-line version of clj-kondo, is it possible to skip non-existing directories? For example:
clj-kondo --list src --lint test --lint api
When there is no api folder, the tool fails with "no such file api".
The thing is, I'm setting clj-kondo on CI such that it covers all Clojure projects, and some of them have the api directory, and some of them do not. Any ideas?I usually do clj-kondo --lint ./
Works great so far
linting root involves some dev stuff which is always broken in terms of linting... yes there is a way to exclude it, but it depends on a project
I'm thinking about clj-kondo --lint $(cat paths.txt) where the path.txt file has all the required paths to lint
clj-kondo --lint (clojure -Srepro -Spath -A:test) is what I do most of the time
With the paths.txt file, I like the idea I can start with a small subset of a project and then extend it file after file, dir after dir
but what enforces that paths.txt does not contain non existed dirs?
each project has its own paths.txt file, e.g some of them include the api dir, some of them don't
I mean over time actual project paths that needs linting might change and there is nothing that synchronise the reality with paths.txt. Most likely not a big problem but you mentioned CI where all those nuances should be automated
@igrishaev how about using this in CI:
mkdir -p api && clj-kondo --lint src:test:api
Hm, smart!
You could also use xargs to build a command line
ls -d src test api 2>/dev/null | xargs -i echo -n --lint "{}" | xargs clj-kondo