akiomik / akiomik/mado

Decide: should mado say something about an ignore file it could not read?

Ouverte
#445 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
question
Langage dominant
Rust
Étoiles
407
Forks
12
Merge moyen
5 h 45 min
PR mergées (30 j)
30

Description

## Context

An ignore file that cannot be read is treated as one that says nothing:

```console
$ printf 'ignored.md\n' > .gitignore
$ chmod 000 .gitignore
$ printf '#Hello.' > docs/ignored.md
$ mado check docs
docs/ignored.md:1:1: MD018 ...
Found 3 errors.
```

Nothing is said about the file mado could not open. This is not new — the same
tree gives the same three errors and the same silence on `main` — and it is the
`ignore` crate's own stance: `create_gitignore` collects errors with
`maybe_push_ignore_io`, which drops the I/O ones, and `Ignore::add_child`'s
documentation says "Note that all I/O errors are completely ignored".

#436 keeps to it. Where mado reads a parent ignore file itself, because the
walker has no reason to look above a root, it reports what it cannot parse and
passes over what it cannot open, so the two readings say the same kinds of
thing.

## Why it is worth a decision

An ignore file that cannot be read changes what mado reports, and the change is
in the direction of reporting more: violations appear in files the user meant
to exclude, with nothing to say why. A permission or a symlink gone wrong is
not a rare kind of accident in a container image or a CI checkout.

## The decision to make

**Should mado say something about an ignore file it could not read?**

- *Leave it as it is:* it is what the walker does, what ripgrep does, and what
mado has always done. A tool that stops for an unreadable file it was not
asked about is its own kind of annoying.
- *Say it and carry on:* one line on stderr per file, alongside the ones about
globs that will not parse. mado would have to say it in both the places it
reads these files from, or it would say it about parent files and not
in-tree ones.
- *Stop:* an ignore file that cannot be read means the answer is unknown, and a
linter that reports the wrong thing quietly is worse than one that refuses.
This is the largest change and the one most likely to be unwelcome in CI.

## Related

- #436
- #441

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.