Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

More documentation on setup and use #33

Closed
jefffriesen opened this issue Feb 22, 2016 · 10 comments
Closed

More documentation on setup and use #33

jefffriesen opened this issue Feb 22, 2016 · 10 comments

Comments

@jefffriesen
Copy link

I use linter/linter-eslint every day and depend on it heavily. I think I've got linter-clojure set up correctly, but can't get any linting errors to show up. These errors have no warnings:

(ns guestbook.routes.home
  (:require [guestbook.layout :as layout]
            [compojure.core :refer [defroutes GET]]))  ;; missing POST

(defroutes home-routes
  (POST "/message" request (save-message! request))

This doesn't give a linting error (too many parens, undeclared variable):

(+ 1 2)))))
wat

I don't think it's a problem with how linting errors are displayed because those are set in the main linter package and I see them properly with linter-eslint.

This makes me think I have something set up incorrectly, but I've gone through closed issues and docs and can't see anything wrong (and I get no errors):

  "linter-clojure":
    clojureExecutablePath: "/Users/jeffers/.m2/repository/org/clojure/clojure/1.7.0/clojure-1.7.0.jar"
    javaExecutablePath: "/usr/bin/java"

clojure-1.7.0.jar is executable -rwxr-xr-x. I've restarted Atom. I've tried Clojure 1.6.0, 1.7.0, 1.8.0. I've turned off the parinfer package. I'm working in Clojure, not ClojureScript.

Either it's not setup correctly somehow or I don't know what type of errors it's checking for. Suggestions?

@Arcanemagus
Copy link
Member

If you open Developer Tools and place a breakpoint here, is it ever hit? If not what does running Editor: Log Cursor Scope from the command palette show?

If you do hit that breakpoint, place another one here and see what output contains.

@jefffriesen
Copy link
Author

Thanks for the debugging tips.

I've tried it in a few different scenarios:

Brand-new lein project.

I put a console.log here and I get this when I have an obvious error, such as (+ 1 2))):

output:  Exception in thread "main" java.lang.RuntimeException: Unmatched delimiter: ), compiling:(/Users/jeffers/git/learning/clojure-class/myapp3/src/myapp3/core.clj:12:9)
    at clojure.lang.Compiler.load(Compiler.java:7234)
    at clojure.lang.Compiler.loadFile(Compiler.java:7165)

Overall the above scenario is working. I get a linter error when I put in an obvious error. But it only shows errors after saving, even though I set it to show while typing with a 300ms delay (in the settings of the mail linter package). linter-eslint follows these settings and shows errors while typing. Not a big deal, but FYI.

Compile error:

This is a trickier problem. When I have a problem with a project that has a compile error:

output:  Exception in thread "main" java.io.FileNotFoundException: Could not locate guestbook/layout__init.class or guestbook/layout.clj on classpath., compiling:(/Users/jeffers/git/learning/clojure-class/guestbook/src/clj/guestbook/routes/home.clj:1:1)
    at clojure.lang.Compiler.load(Compiler.java:7239)
    at clojure.lang.Compiler.loadFile(Compiler.java:7165)...

The app still renders in the browser, I get no warnings through the terminal (using lein run) and I don't see this error in the repl. But the linter internally gets the error and silently fails (unless I console.log output). Once it's fails it doesn't lint errors anymore. A couple thoughts:

  1. Does it make sense to expose the compile errors, especially inline at the source of the problem in the file?
  2. Does it make sense to keep linting anyway even with errors?

Thanks for looking into this

@Arcanemagus
Copy link
Member

Just filed #34, this linter isn't currently setup to run on the fly linting, even though it claims to be to linter.

And exposing errors like that is exactly what this should be doing, @trevershick care to take a look at why that isn't showing up here?

@ghost
Copy link

ghost commented Mar 17, 2016

If you open Developer Tools and place a breakpoint here, is it ever hit?

Yes

If you do hit that breakpoint, place another one here and see what output contains.

"Exception in thread "main" java.io.FileNotFoundException: Could not locate compojure/core__init.class or compojure/core.clj on classpath., compiling:(/home/.../my_web/handler.clj:1:1)
 at clojure.lang.Compiler.load(Compiler.java:7239)
 at clojure.lang.Compiler.loadFile(Compiler.java:7165)
 at clojure.main$load_script.invoke(main.clj:275)
 at clojure.main$init_opt.invoke(main.clj:280)
 at clojure.main$initialize.invoke(main.clj:308)
 at clojure.main$null_opt.invoke(main.clj:343)
 at clojure.main$main.doInvoke(main.clj:421)
 at clojure.lang.RestFn.invoke(RestFn.java:421)
 at clojure.lang.Var.invoke(Var.java:383)
 at clojure.lang.AFn.applyToHelper(AFn.java:156)
 at clojure.lang.Var.applyTo(Var.java:700)
 at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: Could not locate compojure/core__init.class or compojure/core.clj on classpath.
 at clojure.lang.RT.load(RT.java:449)
 at clojure.lang.RT.load(RT.java:412)
 at clojure.core$load$fn__5448.invoke(core.clj:5866)
 at clojure.core$load.doInvoke(core.clj:5865)
 at clojure.lang.RestFn.invoke(RestFn.java:408)
 at clojure.core$load_one.invoke(core.clj:5671)
 at clojure.core$load_lib$fn__5397.invoke(core.clj:5711)
 at clojure.core$load_lib.doInvoke(core.clj:5710)
 at clojure.lang.RestFn.applyTo(RestFn.java:142)
 at clojure.core$apply.invoke(core.clj:632)
 at clojure.core$load_libs.doInvoke(core.clj:5749)
 at clojure.lang.RestFn.applyTo(RestFn.java:137)
 at clojure.core$apply.invoke(core.clj:632)
 at clojure.core$require.doInvoke(core.clj:5832)
 at clojure.lang.RestFn.invoke(RestFn.java:551)
 at my_web.handler$eval3$loading__5340__auto____4.invoke(handler.clj:1)
 at my_web.handler$eval3.invoke(handler.clj:1)
 at clojure.lang.Compiler.eval(Compiler.java:6782)
 at clojure.lang.Compiler.eval(Compiler.java:6771)
 at clojure.lang.Compiler.load(Compiler.java:7227)
 ... 11 more"

I am using Leiningen and it can build my project.

@ghost ghost unassigned trevershick Mar 17, 2016
@ghost
Copy link

ghost commented Mar 17, 2016

Same with ClojureScript code:

"Exception in thread "main" java.io.FileNotFoundException: Could not locate reagent/core__init.class or reagent/core.clj on classpath., compiling:(/home/.../mwe/core.cljs:1:1)
 at clojure.lang.Compiler.load(Compiler.java:7239)
 at clojure.lang.Compiler.loadFile(Compiler.java:7165)
 at clojure.main$load_script.invoke(main.clj:275)
 at clojure.main$init_opt.invoke(main.clj:280)
 at clojure.main$initialize.invoke(main.clj:308)
 at clojure.main$null_opt.invoke(main.clj:343)
 at clojure.main$main.doInvoke(main.clj:421)
 at clojure.lang.RestFn.invoke(RestFn.java:421)
 at clojure.lang.Var.invoke(Var.java:383)
 at clojure.lang.AFn.applyToHelper(AFn.java:156)
 at clojure.lang.Var.applyTo(Var.java:700)
 at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: Could not locate reagent/core__init.class or reagent/core.clj on classpath.
 at clojure.lang.RT.load(RT.java:449)
 at clojure.lang.RT.load(RT.java:412)
 at clojure.core$load$fn__5448.invoke(core.clj:5866)
 at clojure.core$load.doInvoke(core.clj:5865)
 at clojure.lang.RestFn.invoke(RestFn.java:408)
 at clojure.core$load_one.invoke(core.clj:5671)
 at clojure.core$load_lib$fn__5397.invoke(core.clj:5711)
 at clojure.core$load_lib.doInvoke(core.clj:5710)
 at clojure.lang.RestFn.applyTo(RestFn.java:142)
 at clojure.core$apply.invoke(core.clj:632)
 at clojure.core$load_libs.doInvoke(core.clj:5749)
 at clojure.lang.RestFn.applyTo(RestFn.java:137)
 at clojure.core$apply.invoke(core.clj:632)
 at clojure.core$require.doInvoke(core.clj:5832)
 at clojure.lang.RestFn.invoke(RestFn.java:421)
 at mwe.core$eval3$loading__5340__auto____4.invoke(core.cljs:1)
 at mwe.core$eval3.invoke(core.cljs:1)
 at clojure.lang.Compiler.eval(Compiler.java:6782)
 at clojure.lang.Compiler.eval(Compiler.java:6771)
 at clojure.lang.Compiler.load(Compiler.java:7227)
 ... 11 more"

Fun fact: Reagent is a ClojureScript library, as opposed to a Clojure library, and thus neither reagent/core__init.class nor reagent/core.clj are expected to exist.

trevershick was unassigned by urzds 7 minutes ago

This was not intentional.

@Arcanemagus
Copy link
Member

Huh, I'm not sure how you were even able to do that, I thought assigning people required permissions on the repo...

In any case, those errors look to be coming from clojure, not this package. Does it work for you from the CLI?

@ghost
Copy link

ghost commented Mar 30, 2016

In any case, those errors look to be coming from clojure, not this package. Does it work for you from the CLI?

I can run my project from the CLI using Leiningen, yes.

My guess is that:

  1. The Clojure vs. ClojureScript detection could be somehow broken, hence leading to the search for reagent/core__init.class.
  2. The classpath might not be setup according to the Leiningen project.clj, hence leading to linter-clojure's Clojure being unable to find compojure/core__init.class.

@Arcanemagus
Copy link
Member

Unfortunately this project has no active maintainer and I personally have no experience with Clojure so I can't really help much further here as I'm out of ideas 😕

@Arcanemagus
Copy link
Member

Since there were a few different things reported in this thread, some of them have been fixed, and the majority of them are fixed in an upcoming PR, I'm marking this as a duplicate of the issue that was just talking about the unfixed problem in here.

@Arcanemagus
Copy link
Member

Duplicate of #51

@Arcanemagus Arcanemagus marked this as a duplicate of #51 Aug 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants