eastwood

All things realted to eastwood - the Clojure linter
borkdude 2019-08-29T18:26:46.000500Z

would you describe eastwood as a static analysis tool or does it do runtime things?

slipset 2019-08-29T18:27:31.000800Z

it does runtime things

slipset 2019-08-29T18:27:47.001400Z

ie, it uses tools.analyzer to do its work. So it can launch missiles

borkdude 2019-08-29T18:27:54.001600Z

being macro-expansion? or?

slipset 2019-08-29T18:28:00.001800Z

Jepp

borkdude 2019-08-29T18:28:14.002100Z

Is that the most important run-time thing?

borkdude 2019-08-29T18:28:33.002700Z

I'm trying to make a comparison table between different Clojure linters for a presentation

slipset 2019-08-29T18:29:00.003300Z

I think so. There might be some linters that are possible with eastwood which may be hard/impossible with static analysis.

slipset 2019-08-29T18:29:19.003800Z

I know Andy or Bronsa could answer this in greater detail than I can.

borkdude 2019-08-29T18:29:47.004100Z

Does kibit also do macro-expansion that you know of?

slipset 2019-08-29T18:30:01.004400Z

Don’t know, but I don’t think it does.

slipset 2019-08-29T18:30:16.004800Z

I seem to remember that it only looks for patterns in the source code

borkdude 2019-08-29T18:30:44.005300Z

Preview of what I've got right now: https://www.dropbox.com/s/vq17ju5rki6q2u7/Screenshot%202019-08-29%2020.30.41.png?dl=0

2019-08-29T18:31:27.006300Z

I have not heard of another tool other than the Clojure compiler and Eastwood that do eval'ing of all top level forms. The side effects of this are primarily for the purpose of matching the Clojure compiler's behavior as much as possible on analyzing the code.

2019-08-29T18:31:52.006800Z

It is certainly not the only way to do a linter, and not necessarily the best way to go about it.

borkdude 2019-08-29T18:32:28.007300Z

ah, so it really does eval code

borkdude 2019-08-29T18:32:35.007500Z

instead of only macro-expansion

2019-08-29T18:32:50.007800Z

Well, eval in the sense that require of a namespace does, yes.

borkdude 2019-08-29T18:32:56.008100Z

ah right

borkdude 2019-08-29T18:33:25.009100Z

So maybe eval? is a better word then macroexpansion? in that table

2019-08-29T18:33:40.009500Z

The README of Eastwood says this pretty explicitly -- if require of a namespace launches missiles, then so does using Eastwood on that namespace. Not a whole lot of code is written to launch missiles on require of a namespace, though.

2019-08-29T18:34:24.010500Z

In my thinking of it, accurate macro expansion was a goal, and the only way I know how to do that is eval

borkdude 2019-08-29T18:34:57.011200Z

yes, that's true. this came up in the discussion of a convention for linting unused namespaces. if the namespace isn't explicitly used, it could still be required for launching missiles (or loading specs).

borkdude 2019-08-29T18:35:33.011700Z

I'll make a note when explaining the eval? column

2019-08-29T18:36:39.012Z

Eastwood does handle cljc, I am pretty sure. It does not handle ClojureScript

borkdude 2019-08-29T18:37:03.012600Z

I thought of using CLJC as an abbreviation for Clojure and ClojureScript

2019-08-29T18:37:10.012800Z

I think kibit's main purpose isn't really a linter, as much as a 'teach you about idiomatic Clojure'

borkdude 2019-08-29T18:37:40.013400Z

I'll make it into CLJS?

2019-08-29T18:37:43.013600Z

Given that CLJC is the actual file name suffix, maybe separate columns for Clojure and ClojureScript might be clearer?

borkdude 2019-08-29T18:37:55.014100Z

Every linter I listed supports JVM Clojure

2019-08-29T18:37:56.014200Z

If you even want a Clojure column at all, since they will all be yes

borkdude 2019-08-29T18:38:01.014400Z

yeah

2019-08-29T18:38:22.014600Z

Is cljfmt a linter?

borkdude 2019-08-29T18:39:01.015200Z

when I read about linting in the historical sense (on wikipedia) the article included formatting tools

borkdude 2019-08-29T18:40:05.015800Z

> Even though modern compilers have evolved to include many of lint's historical functions, lint-like tools have also evolved to detect an even wider variety of suspicious constructs. These include "warnings about syntax errors, uses of undeclared variables, calls to deprecated functions, spacing and formatting conventions, misuse of scope, implicit fallthrough in switch statements, missing license headers, [and]...dangerous language features".[4]

borkdude 2019-08-29T18:40:22.016Z

https://en.wikipedia.org/wiki/Lint_(software)

2019-08-29T18:41:01.016600Z

ok. It certainly is nice to have info about such tools collected together in one place

borkdude 2019-08-29T18:41:46.016900Z

You can think of cljfmt as a linter for idiomatic formatting

borkdude 2019-08-29T18:43:09.017900Z

I also found this one a while ago, I'll include it: https://github.com/gfredericks/how-to-ns

bronsa 2019-08-29T19:18:41.018500Z

eastwood is a weird hybrid of static and dynamic analysis

bronsa 2019-08-29T19:18:48.018900Z

it doesn't really sit properly in either definition

bronsa 2019-08-29T19:20:10.019400Z

in the context of a single compilation unit, it's purely static analysis

borkdude 2019-08-29T19:37:00.019900Z

Thanks for the clarification