eastwood

All things realted to eastwood - the Clojure linter
2018-09-18T17:43:12.000100Z

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)]}

2018-09-18T17:46:55.000100Z

I think the real fix here is to not use a :post condition as a debug printf :P

2018-09-18T17:47:02.000100Z

(fixing my codebase that is)

slipset 2018-09-18T17:51:47.000100Z

And also hinting that this should be a proper warning in eastwood 😉

slipset 2018-09-18T17:52:40.000100Z

https://github.com/jonase/eastwood/issues/283

2018-09-18T17:59:48.000100Z

yeah - I didn't go too deep reading that, but it seems like it would have been a constant-check type error if eastwood had analyzed more deeply

2018-09-18T18:00:12.000100Z

@slipset thanks btw

2018-09-18T18:02:42.000100Z

is there a known corner case for a destructure of constant data in order to name keys of a hard-coded map resulting in constant test warnings?

slipset 2018-09-18T18:03:43.000100Z

Not sure, @andy.fingerhut might know?

2018-09-18T18:21:01.000100Z

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.

2018-09-18T18:21:19.000100Z

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

2018-09-18T18:21:54.000100Z

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

2018-09-18T18:23:07.000100Z

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.

2018-09-18T23:20:27.000100Z

oooh - I wonder how I did this

ArityException Wrong number of args (2) passed to: error-messages/format-exception
	eastwood.lint/report-analyzer-exception (lint.clj:373)
	eastwood.lint/report-analyzer-exception (lint.clj:369)
	eastwood.lint/lint-ns (lint.clj:408)
	eastwood.lint/lint-ns (lint.clj:399)
	eastwood.lint/eastwood-core/fn--7673 (lint.clj:838)
	eastwood.lint/eastwood-core (lint.clj:836)
	eastwood.lint/eastwood-core (lint.clj:763)
	eastwood.lint/eastwood (lint.clj:965)
	eastwood.lint/eastwood (lint.clj:946)
	eastwood.lint/eastwood-from-cmdline (lint.clj:978)
	eastwood.lint/eastwood-from-cmdline (lint.clj:977)
	clojure.lang.Var.invoke (Var.java:381)
	eastwood.versioncheck/run-eastwood (versioncheck.clj:15)
	eastwood.versioncheck/run-eastwood (versioncheck.clj:9)
	user/eval164 (3e4db74ec9058b02f12b9083b40770ed2b91c24e-init.clj:1)
	user/eval164 (3e4db74ec9058b02f12b9083b40770ed2b91c24e-init.clj:1)
	clojure.lang.Compiler.eval (Compiler.java:7062)
	clojure.lang.Compiler.eval (Compiler.java:7052)
	clojure.lang.Compiler.load (Compiler.java:7514)
	clojure.lang.Compiler.loadFile (Compiler.java:7452)
	clojure.main/load-script (main.clj:278)
	clojure.main/init-opt (main.clj:280)
	clojure.main/init-opt (main.clj:280)
	clojure.main/initialize (main.clj:311)
	clojure.main/null-opt (main.clj:345)
	clojure.main/null-opt (main.clj:342)
	clojure.main/main (main.clj:424)
	clojure.main/main (main.clj:387)
	clojure.lang.Var.applyTo (Var.java:702)
	clojure.main.main (main.java:37)

2018-09-18T23:22:21.000100Z

I think that might be a known issue that has a fix in latest master version of Eastwood

2018-09-18T23:22:56.000100Z

yeah - I was just looking and didn't find it in master, I'll double check my version

2018-09-18T23:24:04.000100Z

I think there was an attempted release of Eastwood version 0.2.9, but due to some kind of naming/release issue 0.2.9 is actually identical to 0.2.8, or something weird like that?

2018-09-18T23:24:56.000100Z

I asked for 0.2.9 and it printed 0.2.8 on startup - I figured it was a project.clj config issue and I triaged it lower than making the linter accept my project code haha

2018-09-18T23:25:59.000100Z

(it's a big old project and introducing a linter has been an adventure)

2018-09-18T23:26:34.000100Z

Are you getting that error when you ask for 0.2.9 ?

2018-09-18T23:27:25.000100Z

yes

2018-09-18T23:27:45.000100Z

(or - I was, I just deleted some commented code and the error went away)

2018-09-18T23:28:15.000100Z

originally I had a false positive constant test warning because a literal hash map was destructured in a let block

2018-09-18T23:28:34.000100Z

then I commented that out and used keyword lookup on each key separately, then got that stack trace

2018-09-18T23:28:44.000100Z

then deleted the commented code and the stack trace went away

2018-09-18T23:29:15.000100Z

I could try releasing an Eastwood 0.2.10 with latest master code, one that prints 0.2.10 as the version number in the output, and see if it fixes anything.

2018-09-18T23:29:50.000100Z

cool - not a priority for me as I found something that works, but that sounds useful generally

2018-09-18T23:30:15.000100Z

also - figuring out how to avoid a false positive constant test for destructuring a map literal would be nice - some day

2018-09-18T23:31:18.000100Z

Might be better if @slipset did it, since they have made changes to Eastwood version stuff that I might not do correctly.

2018-09-18T23:33:17.000100Z

OK, looking at commit history carefully now, the fix for that exception was committed after the repository was tagged with "eastwood-0.2.9", so the fix might not be in any released version now, if that tag matches the released source with version 0.2.9

2018-09-18T23:34:22.000100Z

Sorry if I'm rambling here -- I haven't been doing development on Eastwood for the last few releases, so a bit out of the loop (which is normal when one asks someone else to step in to continue development -- I'm not complaining :)