This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-30
Channels
- # announcements (6)
- # bangalore-clj (1)
- # beginners (169)
- # boot (8)
- # calva (20)
- # cider (32)
- # clj-kondo (78)
- # cljdoc (42)
- # cljs-dev (4)
- # clojure (126)
- # clojure-china (35)
- # clojure-dev (5)
- # clojure-europe (3)
- # clojure-italy (40)
- # clojure-nl (15)
- # clojure-portugal (1)
- # clojure-spec (4)
- # clojure-uk (67)
- # clojurescript (89)
- # community-development (2)
- # core-async (34)
- # cursive (46)
- # datomic (14)
- # dirac (1)
- # duct (8)
- # emacs (11)
- # events (5)
- # fulcro (21)
- # jackdaw (14)
- # jobs-discuss (6)
- # off-topic (37)
- # pedestal (24)
- # perun (1)
- # quil (3)
- # reagent (27)
- # reitit (1)
- # remote-jobs (1)
- # shadow-cljs (47)
- # sql (1)
- # vim (9)
- # yada (1)
why would you only want to exclude key fn args? e.g. (defn -main [& [a b c & _ :as args]])
might also fall under this behavior?
user=> (defn main [& [a b c & _ :as args]])
#'user/main
user=> (doc main)
-------------------------
user/main
([& [a b c & _ :as args]])
same thing if you ask me, you destructure for the doc benefitsso maybe this setting should be named something like :exclude-destructured-public-args
to emphasize it will only happen in public functions created with defn and defmacro?
I’m probably not using the correct terms. If I RTFM https://clojure.org/guides/destructuring , I am suggesting that this option won’t ignore unused sequential destructuring, for example:
(defn print-coordinates-3 [[x y z]]
(println "x:" x ", y:" y "))
would still issue a warning about unused z
.so that’s why I introduced the word keys
but it might not be the right word. :exclude-associative-destructured
might be closer to correct?
right you are, of course. https://clojure.org/guides/destructuring#_associative_destructuring
or maybe you are destructuring only for yourself, not for a public consumer, so :exclude-destructured-fn-args
seems best to me
anyone wants to play with this data https://github.com/borkdude/clj-kondo/tree/dump-analysis/analysis#data before I release it tomorrow?
@borkdude it looks interesting! unfortunately, i don't have the set up to try it before tomorrow -- unless just building the dump-analysis branch is enough? is it correct that the filenames will be full paths or is that based on what is passed in originally?
it's based on what you pass in originally, but it's possible to make that configurable, if you need that. I could also include the jar file names if you want
that could also be useful for the linter itself. {:output {:filenames :absolute}}
or something
iiuc, because from other tooling it's not possible to know what the classpath was when the analysis was done, i'm not sure i can reliably determine the exact files in question. i hope it can be worked out appropriately 🙂
I think this can be implemented as a seperate issue: https://github.com/borkdude/clj-kondo/issues/383
possibly on a related note, would it be possible / useful to be able to recover the classpath that was used at the time of analysis?
I could just return the :lint
option that was used, that would be the most flexible, so what you pass in, you get out
note that when you call clj-kondo with an absolute path, you will already get an absolute path back
i was thinking whether tooling might make use of a user's previous invocation of clj-kondo -- so the tooling wouldn't necessarily know what was used for the classpath
if absolute paths are included in the output, return the lint arguments doesn't add much value I think for tooling
it might, but the user is the one who knows what classpath they want, and if the tool could just read that info from somewhere (e.g. if clj-kondo stored it in its cache), then the tool doesn't have to bother the user about it
i was actually thinking to use clj-kondo's api to make an extension / plugin -- not ask the user to install clj-kondo
this is part of the experimental project to make editor independent tooling -- so far the editors i have been experimenting with are emacs, atom, and vscode
let's just start with the things you need concretely, without speculating too much. I'll add the full file paths option for starters
so the full file path for e.g. clojure.core/defn would be in my case /Users/borkdude/.m2/repo/../../../clojure-1.10.1:jar:clojure/core.clj
but if you're linting only one file without any dependencies like clojure itself, defn is resolved from a built-in cache which has no filenames
so it all depends on what your editor tooling is linting. you can ask the user to index your entire classpath whenever one of the dependencies change
but I guess you don't have to wait for this, just invoke your binary with a full path
I am thinking about eventual use of clj-kondo from cljdoc. Cljdoc takes the convention (and code) from codox to exclude namespaces/fns/vars marked with :no-doc
metadata. Would this be possible with clj-kondo?
added it here: https://github.com/borkdude/clj-kondo/issues/373#issuecomment-515740595
yeah docstring too. This is what codox currently harvests: https://github.com/cljdoc/codox/blob/b29b16ae686e3400689bbdc93df57200b709443d/codox/src/codox/reader/clojure.clj#L131
I'm not sure if I'll get everything in before tomorrow's release, but you won't be using it anyway before import-vars is supported
I want to introduce the concept of a redirect, so when you do (def a 1) (def b #'a)
which I think is what import-vars is doing, then var b is redirected to var a, so when you call b, you also call a
Is it possible to disable all :unused-namespace
warnings for a given namespace? I'd like to disable it for my dev
namespace (my usual home at the repl) as it brings in a variety of utility functions to make them available while developing
@robertfrederickwarner you can using a namespace local config
or you can avoid using use and refer :all (although clj-kondo is able to resolve them when you use a cache)
Absolutely love the tool, it's helped clean up a bunch of code in the past two weeks or so I've been using it
I've put in the local config and toggle syntax checking on and off (my usual routine after modifying my kondo config), but it doesn't appear to be working