Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing namespace parse warning when synstax error in require anywhere in the file #1817

Closed
benjamin-asdf opened this issue Sep 20, 2022 · 1 comment
Projects

Comments

@benjamin-asdf
Copy link
Contributor

benjamin-asdf commented Sep 20, 2022

clj-kondo v2022.09.08`

problem

You have a syntax err in a require function call somewhere. But it warns for the top of the file ns form.

repro

lint this:

(ns foo)

(comment
  (require '[lol oh-no :as]))
$ echo "(ns foo)

(comment
  (require '[lol oh-no :as]))" | clj-kondo --lint - 
> > > <stdin>:0:0: error: Can't parse <stdin>, Unparsable namespace form
linting took 26ms, errors: 1, warnings: 0
@benjamin-asdf
Copy link
Contributor Author

benjamin-asdf commented Sep 20, 2022

master...benjamin-asdf:clj-kondo:master

here is a proposal fix.

  1. add a finding for the actual error, so the user gets a lint err at the correct file ps
  2. add a hint to the namespace warning.
(with-in-str "(ns foo) (require '[lol oh-no :as])"
    (main "--lint" "-" "--lang" "clj"))
<stdin>:0:0: error: Can't parse <stdin>, Unparsable namespace form. Is there a syntax error in a require call somewhere in the file?
<stdin>:1:20: error: Unparsable libspec [lol oh-no :as]
linting took 8ms, errors: 2, warnings: 0

@borkdude borkdude added this to Needs triage in clj-kondo via automation Sep 20, 2022
@borkdude borkdude moved this from Needs triage to High priority (next release) in clj-kondo Sep 20, 2022
@borkdude borkdude moved this from High priority (next release) to In progress in clj-kondo Oct 5, 2022
clj-kondo automation moved this from In progress to Done Oct 5, 2022
borkdude added a commit that referenced this issue Oct 5, 2022
borkdude added a commit that referenced this issue Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
clj-kondo
  
Done
Development

No branches or pull requests

1 participant