eastwood 2019-08-29

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

it does runtime things

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

being macro-expansion? or?

Is that the most important run-time thing?

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

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

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

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

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

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

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.

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

ah, so it really does eval code

instead of only macro-expansion

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

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

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.

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

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).

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

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

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

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

I'll make it into CLJS?

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

Every linter I listed supports JVM Clojure

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

Is cljfmt a linter?

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

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

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

You can think of cljfmt as a linter for idiomatic formatting

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

eastwood is a weird hybrid of static and dynamic analysis

it doesn't really sit properly in either definition

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

Thanks for the clarification