jev-lint (mizchi)
Checks whether a function does what its name says, whether a comment is still true, and whether a test verifies what it claims, with a cutoff per rule.
# jev-lint
[日本語](README-ja.md)
A lint tool that uses [Jev](https://typesafe.ai/) -- a fast classifier that
answers a natural-language question with a calibrated probability instead of
writing text -- to decide what a parser cannot.
This function is wrong, and nothing in your toolchain will say so:
```ts
/** Returns the cart, or null when no cart has this id. */
export function getCart(id: string): Cart {
const cart = carts.get(id);
if (!cart) throw new Error(`no cart ${id}`);
return cart;
}
```
The comment promises `null`. The body throws. The return type is `Cart`, not
`Cart | null`. It type-checks and it lints clean.
A jev-lint rule is one sentence. An [ast-grep](https://ast-grep.github.io)
matcher picks which code to look at, and a model is asked that sentence about
each match -- here, *the comment above this code claims something that is not
true of the code* -- answering with a probability. **The code being judged is
sent to an API**, which is what the key pays for; nothing runs locally except
the matcher.
```bash
export TYPESAFE_API_KEY=... # https://typesafe.ai
npx -y jev-lint check examples
```
```
examples/cart.ts
16 flag The comment above this code claims something that is not true of the code.
comment-describes-declaration 0.89 cutoff 0.56
...
```
0.89 is the model's agreement and 0.56 the cutoff this rule ships with; under
it, nothing is reported. Six findings over two files, for a tenth of a cent;
[what a bigger run costs](docs/cost.md) is measured, not extrapolated.
## What it catches
Forty-eight questions ship, most of them asked in several languages -- 99
rules in all. Roughly:
- **A name against the thing it names.** A function, method, binding, type,
class, trait or module; an npm script against the comm