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

Linting for throw #2172

Closed
skynet-gh opened this issue Sep 1, 2023 · 0 comments
Closed

Linting for throw #2172

skynet-gh opened this issue Sep 1, 2023 · 0 comments

Comments

@skynet-gh
Copy link

Is your feature request related to a problem? Please describe.
When calling throw incorrectly (wrong arity/types), clj-kondo does not issue any warnings. For example given
src/test.clj:

(ns test)

(defn example []
  (throw "err" {:data 1}))

Clojure errors with

$ clj -X test/example
Syntax error compiling throw at (test.clj:5:3).
Too many arguments to throw, throw expects a single Throwable instance

But clj-kondo does not warn

$ clj-kondo --lint src/
linting took 6ms, errors: 0, warnings: 0

Describe the solution you'd like
clj-kondo detects at least the arity if not the types for throw in Clojure (and maybe ClojureScript if possible).

Describe alternatives you've considered
It's a fairly minor annoyance granted, but nice to have for completeness I guess.

lambdank pushed a commit to lambdank/clj-kondo that referenced this issue Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant