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

Common error not identified by linter #1242

Closed
FrankApiyo opened this issue Mar 29, 2021 · 4 comments · Fixed by #1245
Closed

Common error not identified by linter #1242

FrankApiyo opened this issue Mar 29, 2021 · 4 comments · Fixed by #1245

Comments

@FrankApiyo
Copy link
Contributor

version

v2021.03.22

platform

$ java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-8u282-b08-0ubuntu1~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)

problem
clj kondo does not identify a common error

when we have a function that looks as follows:

(defn baz [a b & {:keys [c d] :or {c 10 d 20}}]
         (* a b c d))

sometimes people write it as

(defn baz [a b & {:keys [c d] :or {:c 10 :d 20}}]
         (* a b c d))

please note the colons before c and d
repro

(ns test.issue)
(defn baz [a b & {:keys [c d] :or {:c 10 :d 20}}]
         (* a b c d))

expected behavior
something like....

user:Desktop$ clj-kondo --lint test/issue.clj 
test/issue.clj keyword not expected at line 1
test/issue.clj keyword not expected at line 1
linting took 26ms, errors: 2, warnings: 0
@borkdude borkdude added this to Needs triage in clj-kondo via automation Mar 29, 2021
@borkdude borkdude moved this from Needs triage to Medium priority (new / enhance) in clj-kondo Mar 29, 2021
@borkdude
Copy link
Member

@FrankApiyo Thanks. Seems like a no-brainer to add some linting around this.

@FrankApiyo
Copy link
Contributor Author

@borkdude I'm pretty new to this repo, could you point me to the file where this linting might be added?

@borkdude
Copy link
Member

@FrankApiyo Yes, here:

FrankApiyo added a commit to FrankApiyo/clj-kondo that referenced this issue Apr 2, 2021
clj-kondo automation moved this from Medium priority (new / enhance) to Done Apr 2, 2021
borkdude added a commit that referenced this issue Apr 2, 2021
@borkdude
Copy link
Member

borkdude commented Apr 2, 2021

@FrankApiyo Made a minor enhancement here:

0fa71ae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
clj-kondo
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants