unified plugin to ignore unrelated messages. Currently works in PRs on Travis.
When working with natural language, having tools that check cumbersome tasks can be very useful (think alex or retext plugins). However, natural language isn’t as strict as code. Integrating natural language checking in a CI often doesn’t work well due to false positives. It’s possible to add a long list of exceptions, but this soon becomes unmanageable.
This plugin solves that problem, when in Travis, by ignoring any messages on unchanged lines. When run outside Travis, this plugin doesn’t do anything.
npm install unified-diff
Say we have this
This is an an example.
Then, someone creates a PR which adds the following diff:
This is an an example.++Some more more text. A error.
We have some natural language checking in
var diff =var vfile =var unified =var markdown =var stringify =var remark2retext =var english =var repetition =var article =var report =vfile
lint.js is hooked up to run on Travis in
.travis.yml like so:
# ...script:- npm test- node lint.js# ...
When run in Travis, we’ll see the following printed on stderr(4).
an an on L1 is not included because it’s unrelated to this PR.
readme.md3:6-3:15 warning Expected `more` once, not twice retext-repeated-words retext-repeated-words3:22-3:23 warning Use `An` before `error`, not `A` retext-indefinite-article retext-indefinite-article⚠ 2 warnings
As there are messages, the build exits with
1, thus failing Travis.
The user sees this and amends the PR to the following:
This is an an example.++Some more text. An error.
This time our lint task exits successfully, even though L1 would normally emit an error, but it’s unrelated to the PR.
Ignore messages emitted by plugins before
diff for lines that did not change.
There are no options.
If there’s a
TRAVIS_COMMIT_RANGE environment variable this plugin runs,
otherwise it does nothing.
- Add support for other CIs (ping if you want to work on this)
- Add non-CI support (I’m not yet sure how though)
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.