akiomik / akiomik/mado

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

未关闭
#462 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
question
主要语言
Rust
星标
409
派生
12
平均合并
5 小时 45 分钟
30 天内合并 PR
30

描述

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

贡献指南

打开贡献指南

调研方向

Start by reading RuleLike::check and MD027::check, then reproduce the documented `4:4` before `2:4` result. Compare that library behavior with Command::check and its output sorter, and review the context in #425 and #454. Done means the ordering contract is decided and recorded with tests covering the chosen behavior.

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
backend-api-design, tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
活跃
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。