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

Post-cond warning is printed and not treated as warning #283

Open
slipset opened this issue Sep 18, 2018 · 3 comments
Open

Post-cond warning is printed and not treated as warning #283

slipset opened this issue Sep 18, 2018 · 3 comments

Comments

@slipset
Copy link
Collaborator

slipset commented Sep 18, 2018

dbg wrong-pre-post: condition=(do (println "job-xml:" %) true) line=152 test-ast :op=:do

  • I think eastwood is printing this based on the following input:
    {:post [(do (println "job-xml:" %) true)]}
    looks like this code that is doing it
    src/eastwood/linters/typos.clj:1034
    :else
@slipset slipset changed the title Post-debug warning is printed and not treated as warning Post-cond warning is printed and not treated as warning Sep 18, 2018
@jafingerhut
Copy link
Collaborator

Copies some comments from Slack channel to here, for reference:

Often when writing linters I do not know all of the cases that the tools.analyzer.jvm analyzed data structures might contain, and rather than try to be exhaustive, I iteratively create test Clojure programs that I think should cause the warning, print out what kind of map tools.analyzer created in that part of the code, and handle it. If I think I get several cases covered, I try it out on the crucible set of Clojure projects and look for more. The print statement quickly alerts me if it encounters a case that Eastwood doesn't cover.

It is not a useful Eastwood warning, true, and it is a bit of a wart.

Perhaps changing it to a proper Eastwood warning with a type like :eastwood-unimplemented-case might be better?

The docs could explain that such warnings would be great to report as an Eastwood issue (especially if there is a shareable reproducing test case, as usual) so that Eastwood might be enhanced to handle that case better.

@jumarko
Copy link

jumarko commented Sep 12, 2022

Is this still valid?
I don't know much about eastwood so don't know what this report really says.
But I got this recently:

== Linting my.ns ==
src/my.ns.clj:99:9: wrong-pre-post: All function preconditions should be in a vector. Found: (set? input-arg).

This was really difficult to spot among a lot of other linted namespaces but eventually it printed there was 1 warning

== Warnings: 1. Exceptions thrown: 0

@vemv
Copy link
Collaborator

vemv commented Sep 12, 2022

https://github.com/jonase/eastwood/tree/v1.2.5#wrong-pre-post is an active, maintained linter.

From your report, it sounds like it's doing its job just fine - this issue refers to something else.

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

4 participants