-
Notifications
You must be signed in to change notification settings - Fork 2
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
Misclassification of java interoperability as function #2
Comments
The only method I could think of to do this without running code, and only using structure, would be to look either for |
Thanks for trying it out! I'm glad it's proving helpful. This is an interesting one, and I think you have the solution right. I would rather be silent for potential matches than warn on valid usage. Clojure can allow for some wacky constructions so it's better to play it safe. PR is welcome, if you wanna try your hand at tackling it. I haven't written any documentation for how the pattern matching works or how the rules are defined, lol, but that makes it more fun, right? |
Thanks @NoahTheDuke - I'll have a look - will be interesting! |
I've written a bunch of documentation about how the pattern DSL and rules objects are built, if you're still interested: https://cljdoc.org/d/io.github.noahtheduke/splint/1.1.1/doc/rules |
I'll have a look. Thanks! |
I looked at this but it is tricky. The rough heuristic above with a dot might work for some cases, but it doesn't catch the use of static methods on a Java class. |
Yeah, that's definitely an issue. Without deeper analysis (like clj-kondo does), I suspect there's not much we can do. Maybe we could use the list of built-in classes that Clojure recognizes and extract the |
When mapping using an anonymous fn to use java interop, splint says 'No need to wrap function. Clojure supports first-class functions', but you generally cannot unwrap in this case. e.g.
(map #(Integer/parseInt %) ["1" "2" "3"])
PS. Thank you very much for this linter - really brilliant at identifying style improvements - particularly those where I can vastly simplify code such as preferring
or
etc. Thank you!The text was updated successfully, but these errors were encountered: