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

Reduce undesirable :constant-test linter warnings #111

Closed
jafingerhut opened this issue Nov 17, 2014 · 6 comments
Closed

Reduce undesirable :constant-test linter warnings #111

jafingerhut opened this issue Nov 17, 2014 · 6 comments

Comments

@jafingerhut
Copy link
Collaborator

Probably best done after/when implementing disabling warnings on a per-expression basis, issue #21 .

When doing so, verify whether it can be disabled for all expansions of a macro. Projects like Carmine and core.match have macros that frequently cause :constant-test and other warnings to be generated (see #108), hundreds of times each. I suspect a few well-placed disabling annotations in a few macro definitions could eliminate most of these. That would also be useful for some debug macros people have written in various projects that expand to things like (if debug-enabled (println "foo")) where debug-enabled is a ^:const Var.

@ddossot
Copy link

ddossot commented Nov 26, 2014

FTR I'm using Korma for DB access and expressions like this:

(select fruits)

yield this warning:

suspicious-expression: -> called with 1 args. (-> x) always returns x. Perhaps there are misplaced parentheses?

with eastwood 0.2.0 (version 0.1.4 doesn't report the issue).

@jafingerhut
Copy link
Collaborator Author

Thanks for the report. Yes, this is due to the change that fixed issue #93. While it eliminated some unwanted warnings, it also introduced new ones in cases like this.

I have created a new issue #114 for this, since it is different than what I thought would be a good solution, which is issue #21, but that issue does not include the capability to selectively disable warnings in library code that you would prefer not to edit.

@jafingerhut
Copy link
Collaborator Author

ddossot: I added the lines at the link to a new configuration file that will be part of Eastwood in the next release, version 0.2.1. It is not in any release yet as of this date. It should disable the kind of warnings you mention above when using Korma.

https://github.com/jonase/eastwood/blob/master/resource/config.clj#L136-L183

If you wish to try out the latest unreleased version of Eastwood to see if it improves things for you, you can follow the steps here:

https://github.com/jonase/eastwood#for-eastwood-developers

@ddossot
Copy link

ddossot commented Dec 15, 2014

Indeed:

== Eastwood 0.2.1-SNAPSHOT Clojure 1.6.0 JVM 1.8.0_20
Directories scanned for source files:
  src test
== Linting com.unbounce....db ==
== Warnings: 0 (not including reflection warnings)  Exceptions thrown: 0

0.2.1-SNAPSHOT works great with Korma 😄

@jafingerhut
Copy link
Collaborator Author

ddossot: Thank you for verifying. I will close this issue, then, since your unwanted warnings have been addressed, as well as the original purpose for which I created the issue.

@jafingerhut
Copy link
Collaborator Author

Part of Eastwood release 0.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants