-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
failing to parse due to invalid symbol error #378
Comments
I think the current Clojure reader just happens not to enforce that rule, whereas clj-kondo's parser is stricter. And it may change in the future, see https://clojure.atlassian.net/browse/CLJ-1530 The expected behaviour should be to output a lint error pointing to the actual location of the symbol, i.e.
Here are some other read-time errors that cause the linter to fail for the entire file and output a "can't parse" error at 0:0 clojure.core/ ; <= invalid symbol
: ; <= invalid keyword
10z ; <= invalid number
\u12345 ; <= invalid unicode literal I might try tackling this in the next day or two :) |
@yuhan0 Actually I made a similar patch for keywords to let clj-kondo be less strict about it, since Clojure also accepts it right now and someone was using this to represent CSS using the garden library. The issue: #301 I think the same behavior is desirable for symbols to be consistent. Once Clojure itself enforces it, we can also enforce it in this linter. Regardless, the location of the error can be improved. |
I'm getting (ns name)
(def x (String. "hello")) Removing the I'm using the v2020.7.29 VSCode extension. |
@disalvjn Please try to lint this file without any of your project config. Your project config is likely the problem. I can't reproduce it. |
@borkdude You're right; the issue was with my project config. I had: {:linters
{:unresolved-symbol [(faconne.core/transform) (cats.core/mlet)]}} when I needed to wrap the vector in :exclude like {:linters
{:unresolved-symbol
{:exclude [(faconne.core/transform) (cats.core/mlet)]}}} Thanks for your speedy response and your help! |
@lread Can we close this issue or do you think clj-kondo should handle this differently? |
Yeah, I think we can close, thanks for asking. FWIW, I've decided not to support this illegal syntax, at least for now, in rewrite-cljc. |
version
clj-kondo v2019.07.24-alpha
platform
macOS v10.14.6
problem
clj-kondo is failing with invalid symbol error
repro
Given the following
src/borkdude.clj
source:Sanity check:
clj -m borkdude
outputs:expected behavior
clj-kondo --lint src
outputs no errors.actual behavior
clj-kondo --lint src
outputs:The text was updated successfully, but these errors were encountered: