New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
warn about missing requires and imports #339
Comments
From #clojure Slack: borkdude [5:17 PM]
|
Related #515 |
Hi. I was wondering what the rationale is for expecting a I'm fairly new to Clojure and I couldn't find this being suggested elsewhere. The code seems to work with or without require. PS: Thanks for the awesome tool! |
@markus-wa In general, one should not rely on other namespaces to load certain libraries for you. E.g.: it's an implementation detail in clojure.core whether some of the already required namespaces loads |
Ah ok, that makes sense, thanks! |
Warn about the following:
;;=> missing require (or import) for clojure.string
;;=> unknown alias foo
although we cannot know if foo is supposed to be an alias, a single-segmented namespace, or Java classname.
We would have to exclude known things like
goog
in CLJS.Clj-kondo already have a list of all the by default available classes like
System
.The thing that should be very well researched is false positives.
There's already a function for detecting Java class names:
https://github.com/borkdude/clj-kondo/blob/2b4229ea652021e0e5ec6c73082fcc4c7e35d5f2/src/clj_kondo/impl/namespace.clj#L152
TODO:
Note: the current workaround doesn't work in emacs, since the filename is not included
Maybe later:
The text was updated successfully, but these errors were encountered: