Closed divs1210 closed 4 years ago
@divs1210 Which version are you using? Can you try from master and also provide some source code + filename you are linting?
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
@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
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.
@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?
Hmm, you're right - flycheck doesn't seem to be working in general. Thanks for your help!
@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?
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
Same like in compile, zero warnings
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
I also just noticed, that linting in edn files works fine both in buffer and compile
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 <
Ah, didn't notice. Well, if I do the original compile command with --no-cache there is also 0 warnings
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
Anything I can do to figure it out?
.clj-kondo/config.edn
or a .config/clj-kondo/config.edn
that disables a bunch of stuff/opt/homebrew/bin/clj-kondo --lint /Users/mb/Code/UFY/clj-ufy/bases/site/src/ufy/site/systems/feature/core.clj
and see what it says{: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}}}}}
/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
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.
Mac OS, v2024.03.13
Excluding --lang clj
makes it work
That's really strange but glad something started working :)
Is there a way to make flycheck run the command without --lang clj?
yes, just copy the .el
file from this repo and delete that.
I could add that as an optional variable and submit a PR if you think it's useful
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.
Thank you for the help, this will make my life so much easier
Cool. If you happen to find out more about your problem, please let me know, as I can't reproduce it over here.
Sorry, in another project it still doesn't show error even without --lang
. I'll try to figure it out.
clj-kondo --lint src/project_name/file.cljs
I see a bunch of warnings and errors.If I run
M-x flycheck-verify-setup
, I see:Flycheck Mode is enabled.