clojure-emacs / squiggly-clojure

Flycheck checker for Clojure, using eastwood and core.typed.
GNU General Public License v3.0
204 stars 25 forks source link

“Wrong number of arguments: (4 . 4), 0” appears again! #62

Open FaiChou opened 4 years ago

FaiChou commented 4 years ago

Tested on:

macOS Catalina 10.15
elpa: 26.1
Cider version: 0.22.0 and 20191103.1528
flycheck-clojure version: 20190611.2351
flycheck version: 20191028.2247 

Opening cider-jack-in when in a clj file of a clj project, it always pop up errors when typing any character :

Wrong number of arguments: (4 . 4), 0
Error from syntax checker clojure-cider-eastwood: Done with no errors

Using purcell's config.

And tested with:

;; Local Variables:
;; indent-tabs-mode: nil
;; flycheck-disabled-checker: (clojure-cider-eastwood)
;; End:
pnf commented 4 years ago

I definitely can't reproduce this on the sample project in this repo. From the *Messages* buffer:

[nREPL] Starting server via /usr/local/bin/lein update-in :dependencies conj \[acyclic/squiggly-clojure\ \"0.1.9-SNAPSHOT\"\] -- update-in :dependencies conj \[nrepl\ \"0.6.0\"\] -- update-in :plugins conj \[refactor-nrepl\ \"2.5.0-SNAPSHOT\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.22.3\"\] -- repl :headless :host localhost
[nREPL] server started on 49846
[nREPL] Establishing direct connection to localhost:49846 ...
[nREPL] Direct connection to localhost:49846 established

and then the expected flycheck highlighting:

image

By the way, if you are trying to disable eastwood, the local variable for disabling checkers has a final s in its name.

If you can give me a self-contained repro, I'll investigate further.

eamonnsullivan commented 4 years ago

One way to reproduce this easily for me is to clone clojure-koans (https://github.com/functional-koans/clojure-koans), open one of the files and start cider. Editing becomes painfully slow and I get repeated errors in the Messages buffer: error in process filter: Wrong number of arguments: (4 . 4), 0 [2 times] Error from syntax checker clojure-cider-eastwood: Done with no errors

If I disable eastwood (add it to flycheck-disabled-checkers), the same error just comes out of the next checker (kibit, I think) and so on. I just have to disable flycheck-mode when working on some repos.

pnf commented 4 years ago

I'm pretty sure that this is due to clojure/tools.reader no longer being provided as part of CIDER. As always, you can verify such theories by looking in the *nrepl-messages-... buffer for the clojure command preceding the error, and pasting it manually into the repl. You will probably see a FileNotFoundException from kibit, which uses tools.reader but presumably was counting on CIDER to provide it.

Nobody ever reported testing #59, but I've gone ahead and merged it. If you don't want to wait for it to clear MELPA, the main change is commenting out the exclusion in at line 204 of flycheck-clojure.el:

 ;;(cider-add-to-alist 'cider-jack-in-dependencies-exclusions "acyclic/squiggly-clojure" '("org.clojure/tools.reader"))

After restarting emacs and jacking in, you'll see that \:exclusions\ \[org.clojure/tools.reader\]\] is no longer part of the lein startup, and (hopefully) you won't get the "Wrong number of arguments" error.

eamonnsullivan commented 4 years ago

Yeah, that sounds like the issue: err "Syntax error (FileNotFoundException) compiling at (reader.clj:1:1). Could not locate clojure/tools/reader__init.class, clojure/tools/reader.clj or clojure/tools/reader.cljc on classpath. " Thanks. I will try out the fix.

eamonnsullivan commented 4 years ago

I commented out that line and it worked for me. Thank you!

pnf commented 4 years ago

Awesome. It's really irritating that some linters fail in a manner that produces unparseable output. The invocations are wrapped in (try ... (catch ...)), but exceptions somehow get through sometimes.