borkdude / flycheck-clj-kondo

Emacs integration for clj-kondo via flycheck
94 stars 17 forks source link

Doesn't detect errors even though clj-kondo installed and flycheck verified #8

Closed divs1210 closed 4 years ago

divs1210 commented 4 years ago

Flycheck Mode is enabled.


* If I run `M-x flycheck-buffer` I don't see any errors or warnings
borkdude commented 4 years ago

@divs1210 Which version are you using? Can you try from master and also provide some source code + filename you are linting?

divs1210 commented 4 years ago

Even if I create a fresh file called demo.clj with the contents:

(ns demo)

(random stuff)

I'm seeing the same behavior. I'm using clj-kondo v2020.04.05 and flycheck-clj-kondo 0.0.2

borkdude commented 4 years ago

@divs1210 Could you run flycheck-compile with the checker clj-kondo-clj on that buffer and post the output here?

I'm seeing:

-*- mode: compilation; default-directory: "/tmp/" -*-
Compilation started at Tue Apr 21 16:28:35

clj-kondo --lint - --lang clj --cache < /tmp/demo.clj
AnSiTu borkdude
AnSiTc /private/tmp
<stdin>:3:2: error: unresolved symbol random
<stdin>:3:9: error: unresolved symbol stuff
linting took 7ms, errors: 2, warnings: 0

Compilation exited abnormally with code 3 at Tue Apr 21 16:28:35
divs1210 commented 4 years ago

I'm seeing:

-*- mode: compilation; default-directory: "~/Desktop/" -*-
Compilation started at Tue Apr 21 20:01:50

clj-kondo --lint - --lang clj --cache

and if I try to kill this buffer, it says it has a running process.

borkdude commented 4 years ago

@divs1210 Could this be an issue with flycheck in general? I don't see the filename appended to the command line instruction: < /tmp/demo.clj. Do other flycheck checks work for other kinds of files?

divs1210 commented 4 years ago

Hmm, you're right - flycheck doesn't seem to be working in general. Thanks for your help!

licht1stein commented 3 months ago

@borkdude I have the same error, but in my case flycheck works in elisp buffers. When I run compile I get zero errors from clj-kondo. I put this in the file (foo !)

-*- mode: compilation; default-directory: "~/Code/UFY/clj-ufy/bases/site/src/ufy/site/systems/feature/" -*-
Compilation started at Wed May  1 21:13:38

/opt/homebrew/bin/clj-kondo --lint - --lang clj --filename /Users/mb/Code/UFY/clj-ufy/bases/site/src/ufy/site/systems/feature/core.clj --cache < /Users/mb/Code/UFY/clj-ufy/bases/site/src/ufy/site/systems/feature/core.clj
linting took 13ms, errors: 0, warnings: 0

Compilation finished at Wed May  1 21:13:38

But if I run from command line, I get:

./bases/site/src/ufy/site/systems/feature/core.clj:7:2: error: Unresolved symbol: foo
./bases/site/src/ufy/site/systems/feature/core.clj:7:6: error: Unresolved symbol: !

It's a fresh emacs setup, and for coding I literally just installed CIDER and flycheck-clj-kondo. The setup verifies fine:

Syntax checkers for buffer core.clj<feature> in clojure-mode:

First checker to run:

  clj-kondo-clj
    - may enable: yes
    - may run:    t
    - executable: Found at /opt/homebrew/bin/clj-kondo

Any idea how I can fix it?

borkdude commented 3 months ago

What if you run what flycheck showed directly from the command line:

/opt/homebrew/bin/clj-kondo --lint - --lang clj --filename /Users/mb/Code/UFY/clj-ufy/bases/site/src/ufy/site/systems/feature/core.clj --cache < /Users/mb/Code/UFY/clj-ufy/bases/site/src/ufy/site/systems/feature/core.clj
licht1stein commented 3 months ago

Same like in compile, zero warnings

licht1stein commented 3 months ago

And if I run without the cache part, it hangs:

/opt/homebrew/bin/clj-kondo --lint - --lang clj --filename /Users/mb/Code/UFY/clj-ufy/bases/site/src/ufy/site/systems/feature/core.clj

Version is clj-kondo v2024.03.13

licht1stein commented 3 months ago

I also just noticed, that linting in edn files works fine both in buffer and compile

borkdude commented 3 months ago

And if I run without the cache part, it hangs

This is because you don't feed it any input on stdin, you removed the <

licht1stein commented 3 months ago

Ah, didn't notice. Well, if I do the original compile command with --no-cache there is also 0 warnings

borkdude commented 3 months ago

I can't reproduce that, but it's good that you can so at least we can rule out flycheck for now:

$ clj-kondo --lint - --lang clj --filename /tmp/dude.clj --cache < /tmp/dude.clj
/tmp/dude.clj:1:2: error: Unresolved symbol: foo
/tmp/dude.clj:1:6: error: Unresolved symbol: !
linting took 46ms, errors: 2, warnings: 0
licht1stein commented 3 months ago

Anything I can do to figure it out?

borkdude commented 3 months ago
licht1stein commented 3 months ago
{:linters      {:unresolved-namespace {:exclude [integrant.repl
                                                 integrant.repl.state
                                                 user]}
                :unresolved-symbol    {:exclude [(clojure.test.check.clojure-test/defspec)
                                                 (clojure.core/comment
                                                   [;; refers from `user` ns
                                                    pprint
                                                    system])]}}

 :output       {:exclude-files ["user"]}
 :ns-groups    [{:pattern "\\S+.unit$" :name units}
                {:pattern "\\S+.unit-test" :name unit-tests}]
 :config-in-ns {units      {:linters {:unused-binding {:exclude-destructured-keys-in-fn-args true}
                                      :missing-docstring {:level :warn}}}
                unit-tests {:linters {:unused-namespace {:level :off}
                                      :refer            {:level :off}}}}}
licht1stein commented 3 months ago
/opt/homebrew/bin/clj-kondo --lint /Users/mb/Code/UFY/clj-ufy/bases/site/src/ufy/site/systems/feature/core.clj
/Users/mb/Code/UFY/clj-ufy/bases/site/src/ufy/site/systems/feature/core.clj:7:2: error: Unresolved symbol: foo
/Users/mb/Code/UFY/clj-ufy/bases/site/src/ufy/site/systems/feature/core.clj:7:6: error: Unresolved symbol: !
linting took 41ms, errors: 2, warnings: 0
borkdude commented 3 months ago

What clj-kondo version are you running and what OS?

Perhaps remove --lang clj from the above command (as flycheck executes) it and try a bunch of other stuff, until it works and then report back. I can't really tell what's going on.

licht1stein commented 3 months ago

Mac OS, v2024.03.13

licht1stein commented 3 months ago

Excluding --lang clj makes it work

borkdude commented 3 months ago

That's really strange but glad something started working :)

licht1stein commented 3 months ago

Is there a way to make flycheck run the command without --lang clj?

borkdude commented 3 months ago

yes, just copy the .el file from this repo and delete that.

licht1stein commented 3 months ago

I could add that as an optional variable and submit a PR if you think it's useful

borkdude commented 3 months ago

I'd rather not remove/change stuff without knowing what is the root cause. So digging deeper to see why this happens is what should happen first.

licht1stein commented 3 months ago

image

licht1stein commented 3 months ago

Thank you for the help, this will make my life so much easier

borkdude commented 3 months ago

Cool. If you happen to find out more about your problem, please let me know, as I can't reproduce it over here.

licht1stein commented 3 months ago

Sorry, in another project it still doesn't show error even without --lang. I'll try to figure it out.