akiomik / akiomik/mado

Decide: does RuleLike::check owe its caller source order?

Abierto
#462 0 comentarios 0 reacciones 0 asignados Ver en GitHub
question
Lenguaje dominante
Rust
Estrellas
407
Forks
12
Merge medio
5 h 45 min
PR fusionados (30 d)
30

Descripción

`RuleLike::check` returns the violations a rule found in whatever order the rule
walked the document, and nothing says what that order is. MD027 can now return
them with a later line before an earlier one.

## Reproduction

```markdown
> > a
> b
>
> c
```

`MD027::check` returns `4:4` and then `2:4`. `doc.ast.descendants()` reaches the
outer quote first, so the outer quote's later block on line 4 is measured before
the walk reaches the nested quote, whose lazily continued line 2 belongs to the
inner one.

`mado check` is unaffected: `Command::check` sorts with
`config.lint.output_format.sorter()` before printing, and every output format
orders by `Violation::position().start`.

## What there is to decide

Whether a rule owes its caller source order at all. The sort in `Command::check`
is what the command needs; a library caller reading `RuleLike::check` gets
whatever the walk produced, which was source-ordered for every rule until a rule
started measuring more than one block of a container. Nothing tests it either way.

Tied to #425, which asks whether the library surface is public API before the next
release: if it is, this is part of what the surface promises.

Raised while working on #454, which is what made MD027 walk a quote's later
children.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.