Fork me on GitHub

Is there an exclusion list for unused imports?


Also, was there a way to use Clojure metadata to configure clj-kondo?


@fiddlerwoaroof You can provide metadata on the ns form for per-file configuration overrides.


  (:require [clj-time.coerce :as tc]
            [clj-time.core :as t]
            [clj-time.format :as tf]


Note the ' so the symbol names do not get evaluated!


Thanks, I really dislike the friction a separate config file adds


(metadata on ns can come before the namespace name if you use ^)


I have a config file in each project, at this point, with just that one override so far.


My current issue is that I have to import a JDBC driver, but I never use it directly and I can't figure out how to hide the warning


Really? Why is that?


Because it's used implicitly when the connection string is parsed


Hmm, maybe I don't need the import


Neither nor next.jdbc need you to import the JDBC drivers.


Cool, I wasn't thinking things through


Fixed your warning for you! 😆


Heya @borkdude! I am slowly dipping my toes back into rewrite-cljc. It has been a long while since I spent time with my old reliable and helpful clj-kondo. I have missed her and the reunion is delightful. I noticed 2 small things while updating to the latest clj-kondo (remember I have been away for literally months!): 1. clj-kondo --help does not show cljc as a valid option for --lang, should it? 2. I had to add "<stdin>" to my clj-kondo .config.edn->`:output` -> :include-files to get spacemacs to show clj-kondos findings. I now have :output {:include-files ["<stdin>" "^src" "^test" "^script"]}. If having to include <stdin> is by design, a note in the docs might be helpful. Am happy to make PRs for above if there is any work to do.


@lee 1) Yeah, it should. 2) Why are you excluding test files from linting in your editor? Clj-kondo is pretty helpful there too. Scripts: dunno. Maybe just try without the entire include-files thing and start over?


For 2) I have a single clj-kondo config to support CI scripts and my editor. My CI script runs clj-kondo with my project classpath but I only want to see clj-kondo warnings from my project sources. You helped me come up with this solution in the very early days, but that was long ago and maybe there is a better way.


@lee In CI you can add the --config flag to pass additional config, they will be merged


ah… ok, thanks will give that a go.


ya that works great, thanks @borkdude! simple_smile


Hi, I’ve made a try-let abomination macro that needs to be linted as both a let and a try block. How can I configure it? Usage:

(try-let [a (db-connection)
          b (might-throw)]
  (process a b)
  (catch Exception e
    (when a (close a))
    (when b (close b))
    (throw e)))


you can turn off linting with :unresolved-symbol {:exclude [(weird.macros/try-let)]}


Is it possible to extend the analyzer instead with a custom analyzer? I scanned the source briefly and I can’t find a way?


not at the moment


@yonatanel It won't help you but my opinion, after spending a bunch of time trying to get clj-kondo to "like" some of my macro-based code, is that it's a really good idea to make sure you don't create new syntax via macros that doesn't "match" something that is in Clojure already 🙂 It's made it clear to me just how hard it would be for someone new to my code to be able to read stuff that uses macros that have "unexpected" syntax. I'm seriously rethinking some of the syntax in my Expectations library at this point, after wrestling with clj-kondo!

❤️ 24

True, we get carried away sometimes.


First rule of macro club, don't create macro's (unless there is an extremely compelling reason)