Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

1.4 KB
Raw Blame

title: Frequently Asked Questions description: Find answers to Harper contributor questions, including the difference between Linter and PatternLinter.

Frequently Asked Questions

This page will be composed of frequently asked questions for contributors.

What's the Difference Between a Linter and a PatternLinter?

A diagram that shows the relationship between a Linter and a PatternLinter

A Linter is a Rust trait for a type that queries a Document to identify grammatical errors, returning a human-readable list of errors, optionally with suggestions that could resolve them.

A PatternLinter is another Rust trait for a type that can hook into the PatternLinter framework. The PatternLinter provides a pattern, which the framework locates inside of documents. When a sequence of tokens is matched, they are provided to match_to_lint to map the match to a human-readable error.

All types that implement PatternLinter also implement Linter thanks to a blanket implementation of the latter upon the former.