Skip to content

feat: the house-style lint for verbs with no-nouns - #59

Merged
webern merged 5 commits into
mainfrom
m/deslag-peeves
Sep 27, 2026
Merged

webern merged 5 commits into
mainfrom
m/deslag-peeves

Conversation

@webern

@webern webern commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

deslag ships its first house-style lint. The owner's pet peeves are constructions, not strings, so this PR first builds the machinery they need: a closed pattern matcher over the document's tokens, in the library, where a lint and a measurement run the same code.

The matcher (src/lint/pattern.rs) matches a sequence of items — a literal word, a token kind, a word with a suffix, a word in (or not in) a named set, a word without certain characters, an inline-code span — with optional items and a bounded gap, inside one sentence. No regular expressions over raw text, no user-supplied patterns, no part-of-speech guesses. Matches are leftmost-first, longest, and never overlap.

The lint (verbs_no_nouns) flags the "verbs no noun" construction from #43: "deslag ships no binaries" where "deslag does not ship binaries" is meant. It is off by default — unlike the phrase catalogue, it flags ordinary human prose too, so turning it on is a deliberate act: [md.lints.verbs_no_nouns] in the config, with the usual message override. The advice owns the rule as the house's style, never claims the sentence is machine-written, and says up front that swapping no for zero, without, lacks or free of is not the fix — negate the verb or drop the absolute claim.

The evidence is asserted, not stored. Nothing is recorded for a reader to trust: the claims are re-derived on every run. On the in-tree corpus the lint holds 62 of 380 llm files (16.3%) against 18 of 381 human (4.7%), a ratio of 3.4; the tests assert llm is at least 3 times human. On the corpus image the lint holds 1,325 of 7,709 llm files (17.2%) against 263 of 10,200 human (2.6%), a ratio of 6.7; the same every-fixture pass asserts the ratio and the 3% human ceiling there. This also answers #57's complaint about counted numbers: there are none to drift.

The measurement tool gains a patterns command that measures candidate constructions that did not ship, with masked matches, over files whose sidecar says they are English:

pattern human llm mixed
three or more inline-code spans in a sentence 27.1% 57.1% 60.3%
not X but Y 4.7% 2.4% 5.0%
it's not just X 0.3% 0.3% 0.0%
verbs_no_nouns (shipped) 4.7% 16.3% 11.1%

The code-span series is structural and high-volume, but humans write triple-backtick lists too — the mixed tier sits at the llm tier — so it stays with the listing family of #16 rather than shipping as a peeve. not X but Y is human-heavier than llm on the tree: it is ordinary English, not a tell. "it's not just" is rare enough that a phrase list, not a construction, is where it belongs if anywhere. Each rejection is recorded with its numbers so nobody re-proposes it without new evidence.

False positives are pinned, not hoped away. The matcher excludes function words ending in s (is, was, does, as, this, its, …), clause-complement verbs ("ensures no request is dropped" negates nothing), stop words after no (no longer, no more), and any word containing an apostrophe (there's, let's). Each class is a case test that must not match. The exclusion words that the measurement earned are in the lint-visible sets; the remaining tree hits on human files are the construction itself, which is what a house-style rule is for.

Testing

  • make ci: exit 0
  • in-tree corpus test: llm >= 3 x human over English fixtures (measured 3.4)
  • big-tier assertions folded into the every-fixture pass: ratio and 3% human ceiling (measured 6.7, 2.6%)
  • case tests: a hit, the lint off, a message override, and each false-positive class as a non-match
  • golden files regenerated and reviewed; the repo's own prose fixed where the lint fired on it

References

A pattern is a row of items written as Rust data: a literal word, a
token kind, a suffix, a word in or not in listed sets, optional items
and a bounded gap. It matches within one sentence, folds case the way
banned_phrases does, and returns the token ranges of its matches,
leftmost first, then longest, never overlapping.
verbs_no_nouns fails a sentence that negates a verb through its object,
as in "ships no binary", where this repo writes "does not ship a
binary". It is built on the token pattern matcher: a word ending in s
with no apostrophe, then no, then a word. Closed sets of function words,
clause verbs and idioms after no are Rust data, not config.

It is off by default and takes only a message. The corpus test holds
its claim on English fixtures: llm files hold it at least 3 times as
often as human files on the tree. The big-tier catalogue pass, which
already reads every file, checks the same ratio there and that at most
3% of human files hold it. The cases pin each false-positive class.
Turn verbs_no_nouns on for this repo and fix what it finds in the
design docs and the blobstore notes.
deslag-corpus patterns counts the English files that hold each
construction the pattern matcher finds, per label and per compared
tool, with masked examples. It runs the constructions considered for a
lint and not shipped, held in the CANDIDATES table in patterns.rs, and
the verbs_no_nouns pattern by its lint's id. There is no flag for a
pattern of the user's own.

It reads each file again with Document::markdown, since the measured
ids turn every code span into one separator. Files in another language
get a table of their own and are in no label's rate. The masker moves
out of candidates' examples into a function both commands call; it now
masks code spans inside a match too.
@webern webern added enhancement New feature or request ai Primarily authored by AI (whether PR, Issue, Whatever) area/config Has to do with deslag configuration (deslag.yaml, etc.) area/lint Deals with the linting algorithms themselves, how they work. labels Sep 27, 2026
@webern
webern marked this pull request as ready for review September 27, 2026 17:15
@webern
webern merged commit 48be1a7 into main Sep 27, 2026
2 checks passed
@webern
webern deleted the m/deslag-peeves branch September 27, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Primarily authored by AI (whether PR, Issue, Whatever) area/config Has to do with deslag configuration (deslag.yaml, etc.) area/lint Deals with the linting algorithms themselves, how they work. enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deslag bakes no cakes: lint the "verbs no nouns" tic

1 participant