eastwood

All things realted to eastwood - the Clojure linter
slipset 2020-01-05T21:00:18.000600Z

I’m having a problem with Eastwoods tests which I can’t really figure out:

lein test eastwood.test.linters-test
Warning: *var2* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *var2* or change the name
Warning: *var2* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *var2* or change the name. (testcases/f01.clj:152)
cases/testcases/f03.clj:66:5: Reflection warning - call to method browse on java.lang.Object can't be resolved (no such method).
Pretty-printed diffs between actual and expected lint results:
[{{:linter :deprecations,
   :msg
   "Static method 'public static void <http://org.apache.commons.io|org.apache.commons.io>.IOUtils.closeQuietly(<http://java.io|java.io>.Writer)' is deprecated.",
   :file "testcases/f07.clj",
   :line 193,
   :column 24}
  1,
  {:linter :deprecations,
   :msg
   "Static method 'public static void <http://org.apache.commons.io|org.apache.commons.io>.IOUtils.closeQuietly(<http://java.io|java.io>.Writer)' is deprecated.",
   :file "testcases/f07.clj",
   :line 197,
   :column 7}
  1}
 nil]

lein test :only eastwood.test.linters-test/test1

slipset 2020-01-05T21:01:11.001500Z

I can’t really understand why this is failing, but I see that closeQuietly is called twice in f07.clj

slipset 2020-01-05T21:01:36.002Z

Also, I can’t seem to bisect my way back to a place where this is not failing.

slipset 2020-01-05T21:02:08.002700Z

And looking at the commits (and circle-ci’s builds) this doesn’t make sense to me at all.

slipset 2020-01-05T21:02:44.002900Z

https://github.com/jonase/eastwood/commits/master

2020-01-05T21:03:02.003200Z

Looks like perhaps only a difference in line and column numbers?

2020-01-05T21:03:17.003500Z

which could happen if someone edited f07.clj source file

slipset 2020-01-05T21:05:55.004100Z

Yeah, but I can’t really see that (nor can I see that the error message is listed as an expected one?)

2020-01-05T21:08:10.004400Z

OK, looking more carefully now, after reproducing locally ...

2020-01-05T21:09:50.005Z

It looks like both of those warnings are being generated when you run the test, but the expected results contain neither of them.

slipset 2020-01-05T21:10:09.005600Z

Agreed

2020-01-05T21:10:21.006Z

Perhaps a root cause might be that the closeQuietly method is now annotated as deprecated, but was not when the test was created

slipset 2020-01-05T21:10:57.006600Z

But that’s kind of strange isn’t it, as it’s pegged at 2.4?

slipset 2020-01-05T21:11:24.007200Z

Oh, wait, maybe something else depends on io-utils has up’ed the version?

slipset 2020-01-05T21:14:09.007600Z

doesn’t seem like it.

2020-01-05T21:15:47.008700Z

I don't have any guesses yet, but found this commit that introduced the test in 2015, and it has a fair number of comments about what it was trying to fix: https://github.com/jonase/eastwood/commit/48345f026ace78926eb9d51cc7ffc761b1227b77

slipset 2020-01-05T21:16:06.009200Z

closeQuietly doesn’t seem to be deprecated (from the docs).

2020-01-05T21:16:20.009600Z

which seem to involve using reflection API to get info about some Java methods.

slipset 2020-01-05T21:17:33.010Z

That commit passes 🙂

2020-01-05T21:22:21.010400Z

That sounds like a fairly large number of commits for a bisect process.

slipset 2020-01-05T21:22:38.010700Z

I seem to be somewhere interesting now

slipset 2020-01-05T21:22:49.010900Z

e9481c83a9b33749b6b87a4c230cd26a57e2d92b passes

slipset 2020-01-05T21:24:42.011200Z

Seems like it was introduced in 35cc845a10a8144fc48ca223c222129f16a2e759

2020-01-05T21:26:33.011700Z

OK. I am not intimately familiar with that Leiningen option and what it does.

slipset 2020-01-05T21:27:23.012200Z

The funny bit is that removing the :eval-in-leiningen true bit doesn’t help.

slipset 2020-01-05T21:31:09.012500Z

strike that, I was editing the wrong file.

slipset 2020-01-05T21:33:11.012800Z

yep, master works without the :eval-in-leiningen true

slipset 2020-01-05T21:35:16.013100Z

Aaand, problem solved 🙂

slipset 2020-01-05T21:35:28.013300Z

At least understood.

borkdude 2020-01-05T21:36:18.014200Z

eval-in-leiningen is for plugins, I think

slipset 2020-01-05T21:36:32.014400Z

leiningen-2.9.1 depends on commons-io 2.6 where closeQuietly is deprecated

slipset 2020-01-05T21:37:19.015100Z

I guess the reason I added eval-in-leiningen was to make eastwood lint itself.

borkdude 2020-01-05T21:43:36.015400Z

maybe you can use a profile for that?

slipset 2020-01-05T21:45:00.016Z

Don’t know. Will have to investigate tomorrow. For now, downgrading to lein-2.8 works wonders

slipset 2020-01-05T21:45:37.016700Z

@andy.fingerhut sorry for the noise. I guess I owe you YAVB.

2020-01-05T21:47:05.017100Z

YAVB? Neither Google nor my memory are helping me there.

slipset 2020-01-05T21:48:01.017400Z

Yet Another Virtual Beer 🙂

slipset 2020-01-05T21:48:04.017600Z

Just invented that

2020-01-05T21:48:26.017900Z

ah, I accept 🙂