-
Notifications
You must be signed in to change notification settings - Fork 66
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
Error when linting files with tagged literals #222
Comments
Possibly relevant: https://github.com/clojure/tools.reader/issues/5 |
Thanks for the references to other issues. They do look relevant. |
At a very crude level I was able to stop the error by binding *default-data-reader-fn* so as to prevent This assumes that none of the lints need to know the actual value of a tagged literal after processing. I do not know if this is valid. Also I am not sure where best to put the binding; certainly it doesn't work in The 'full' solution would be to locate the classpath roots of the linted code and the Hope that helps,
|
This also happens when datomic is used. The |
The following patch does, at least on my test project, load up the diff --git a/src/eastwood/lint.clj b/src/eastwood/lint.clj
index 7ad6d73..1cf6681 100644
--- a/src/eastwood/lint.clj
+++ b/src/eastwood/lint.clj
@@ -591,6 +591,8 @@ curious." eastwood-url))
(defn lint-ns [ns-sym linters opts warning-count exception-count]
+ (#'clojure.core/load-data-readers)
+ (binding [eastwood.copieddeps.dep10.clojure.tools.reader/*data-readers* *data-readers*]
(let [cb (:callback opts)
error-cb (util/make-msg-cb :error opts)
note-cb (util/make-msg-cb :note opts)
@@ -641,7 +643,7 @@ curious." eastwood-url))
Lint results may be incomplete. If there are compilation errors in
your code, try fixing those. If not, check above for info on the
exception."))
- exception))))
+ exception)))))
(declare last-options-map-adjustments) Any comments welcomed. (@lenw I've never used datomic so can't comment, I assume it's the same issue) Also I believe that the contents of dep10 are an older version of |
@pedro-w Thanks for the tested patch! Good to have some working code to start from when creating a change to handle this case in Eastwood. I do not know when that might be, but if @divergentdave has any interest in making such changes, it is very likely he would beat me to it. Agreed that Eastwood's copied-in version of tools.reader will need an update to handle Clojure 1.9's namespaced maps. |
Tagged literals are new to me, so no promises. I may poke at it if I have
time.
|
Thanks, both. Let me know if I can help. Basically the core reader will load up the data readers automatically (code in https://github.com/clojure/clojure/blob/964232c7bf442787740fa0200b289b3495b1ec09/src/clj/clojure/core.clj#L7712 ) but tools.reader won't (by design), so my patch just does what the core reader would do and then binds the result where tools.reader can see it (sorry if that explanation was obvious!). I'm not sure, though, if the way that the data_readers.clj files are located will always be correct for what we want. The innards of clojure itself are a bit mysterious to me... |
Has there been any progress on this? Or perhaps a way to modify the source code so Eastwood doesn't crash? We use lots of Datomic's Thanks! |
Is there any reason @pedro-w's working patch isn't making it into the code? This issue prevents Eastwood from linting any project with tagged literals |
I am getting an error when using Eastwood on files that use tagged literals.
For example,
File:
src/ewe/core.clj
File:
src/data_readers.clj
which runs OK with
lein run
but withlein eastwood
gives:Using clojure 1.8.0, lein 2.7.1, eastwood 0.2.4
The text was updated successfully, but these errors were encountered: