clojure-emacs/squiggly-clojure

I'm getting no Eastwood errors

Closed this issue · 16 comments

Good day, Sir! Thanks for making this. :-)

I'm getting Kibit errors, so something is working, but Eastwood is apparently very happy with my code. I've tried triggering it with unbounded :use and misplaced docstrings.

From what I can tell by a little debugging, the stdout-handler of nrepl-make-response-handler is never called. The value-handler is just called with {:some-warnings true}.

Any ideas?

pnf commented

Cool. This is getting tested outside my messed up environment. I'm sure I can fix this tomorrow morning.


Sent from my VAX-11/780

On Dec 16, 2014, at 17:22, Magnar Sveen notifications@github.com wrote:

Good day, Sir! Thanks for making this. :-)

I'm getting Kibit errors, so something is working, but Eastwood is apparently very happy with my code. I've tried triggering it with unbounded :use and misplaced docstrings.

From what I can tell by a little debugging, the stdout-handler of nrepl-make-response-handler is never called. The value-handler is just called with {:some-warnings true}.

Any ideas?


Reply to this email directly or view it on GitHub.

pnf commented

Although none of the changes I just made seem relevant to your issue, it's probably worth reproducing it with the latest code. This now relies on somewhat more clojure code, which lives in a clojar. If the problem persists, you can bump squiggly-clojure-chat-level to two, which dumps out nearly every callback into **Messages**, so you can tell whether the callback still is not being called, or if something else is going on.

If the callbacks are still not getting run, can you try running the test directly in the REPL?

(eastwood.lint/eastwood {:source-paths ["src"] :test-paths ["test"]})

If that produces no errors, try in a fresh REPL, as there may be some problems with running eastwood repeatedly on the same namespaces in this fashion. If there are still no errors in the fresh REPL, try

lein eastwood

and if that gives no errors, then I defer entirely to eastwood people.

The checks are all failing with ClassNotFound exceptions. I tried getting it to work manually in the repl. Here are my results:

user=> (require 'squiggly-clojure.core)
CompilerException java.lang.ClassNotFoundException: eastwood.lint, compiling:(squiggly_clojure/core.clj:67:36) 

user=> (require 'eastwood.lint)
nil
user=> (require 'squiggly-clojure.core)
nil
user=> (require 'squiggly-clojure.core :reload)
CompilerException java.lang.ClassNotFoundException: clojure.core.typed, compiling:(squiggly_clojure/core.clj:84:30) 

user=> (require 'clojure.core.typed)
nil
user=> (require 'squiggly-clojure.core :reload)

CompilerException java.lang.ClassNotFoundException: kibit.check, compiling:(squiggly_clojure/core.clj:91:9) 
user=> (require 'kibit.check)
WARNING: record? already refers to: #'clojure.core/record? in namespace: clojure.core.logic, being replaced by: #'clojure.core.logic/record?
nil
user=> (require 'squiggly-clojure.core :reload)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: _squiggly in this context, compiling:(squiggly_clojure/core.clj:99:3) 

Running eastwood manually in the repl works, as does check-ew when I paste that code straight into the repl.

pnf commented

This is happening because of my attempt to handle the linter dependencies unconventionally. I've reverted to declaring them explicitly as dependencies of squiggly-clojure, which means for the moment that you'll get all three whether you want them or not (though core.typed won't actually display messages unless you include it in the namespace declaration).
These changes are in my latest push and deployment to clojars snapshot.

pnf commented

The sample-project directory now contains a barebones project.clj, so I can test more easily in an isolated environment.

Seems to be working now. At least the very first run of Eastwood - then I get

Typecheck not run: class java.lang.OutOfMemoryError

and it stops working again. This is with Xmx at 2048M. I'll try and give it even more and see how that works.

Yeah, at Xmx 4096M I'm still getting Typecheck not run: class java.lang.OutOfMemoryError - not sure how to handle that.

I've now hacked your emacs lisp to only run Eastwood checks. Seems to be working after a few runs. I'll report back.

pnf commented

Unless you have an unreasonably huge source file, this may be a complaint to pass on to core.typed.

In the mean time, I'll add a custom variable to choose the checks that occur. This was happening previously by catching an exception in Clojure when the require failed, allowing you to just leave the linter out of your project.clj.

I've now walked through a rather big project, running eastwood on each namespace via squiggly, and it's working nicely. :-)

pnf commented

Cool. There's now a defcustom to select checkers. Even seems to work.
I was thinking of setting the checks to run only when the file is saved, or possibly increasing the necessary idle time after unsaved changes. Let me know if you think any changes along these lines would be useful.

Thanks for your work on this. I'll make sure to ping back after using it for a while.

One last tip: You should probably prefix your elisp functions and vars with a namespace - since all names are global in Emacs. :-)

pnf commented

I believe I shall steal this.


Sent from my VAX-11/780

On Dec 17, 2014, at 14:52, Magnar Sveen notifications@github.com wrote:

Yeah, I've done for all flychecks: https://github.com/magnars/.emacs.d/blob/master/settings/setup-flycheck.el


Reply to this email directly or view it on GitHub.

pnf commented

Will do. Thanks!


Sent from my VAX-11/780

On Dec 17, 2014, at 14:54, Magnar Sveen notifications@github.com wrote:

Thanks for your work on this. I'll make sure to ping back after using it for a while.

One last tip: You should probably prefix your elisp functions and vars with a namespace - since all names are global in Emacs. :-)


Reply to this email directly or view it on GitHub.