-
Notifications
You must be signed in to change notification settings - Fork 66
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
Eastwood confused by core.typed annotation #63
Comments
This makes sense given the way it is currently implemented in Eastwood (at least up through the latest released version 0.1.2). Will have to think about whether there is a good way to avoid this, or just document it better. It is not trivial to avoid because today's linting runs either: (1) on pre-analyzed source code forms (like this one), and is thus easily messed up by symbols like "is" defined in other namespaces, or part of a special language within a macro argument or (2) on post-analyzed ASTs, which occurs after macro-expansions, currently with little or no way to tell what the analyzed code was macro-expanded from. Thus you are left with trying to detect the presence of a macro like clojure.test/is by the "shape" of its post-macroexpanded AST. I believe the most accurate solution would be to do (2), but include in the AST ways to tell what the original un-macroexpanded forms were, ideally through every step of macroexpansion, then look through the ASTs for occurrences of clojure.test/is. |
Could you do (1) but with a deeper analysis of the |
See issue #71 for a new tools.analyzer feature that might make it easier to enhance Eastwood for this issue, too. |
….test and only issue :suspicious-test warnings if they are clojure.test/is. This is becoming more important now that core.typed has defined its own (is ...) expression, which confused the previous implementation that only looked at forms in the source code, with no name resolution.
I've committed a change that should fix this issue in the next Eastwood release. It uses approach (2), because Nicola Mometto enhanced tools.analyzer(.jvm) to make it easy to determine from the ASTs what the original forms were before macro expansion. From that it is not difficult to determine which occurrences of 'is' are from clojure.test, or other namespaces like the one in core.typed. No set date planned for the next release, but I will update this ticket when it happens, as well as announce it on the Clojure Google group. |
Eastwood 0.1.4 is released. Please give it a try and let us know whether it helps to eliminate the incorrect warnings. |
Big thumbs up here for 0.1.4 - thank you! |
Example:
Eastwood flags
(is PromoRecord 0)
as a suspicious use of clojure.test/is even tho' we don't reference clojure.test in the code.The text was updated successfully, but these errors were encountered: