sloplint 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 104eaad3b0c8de01284f36733d607140b606feb03b9f216225e62f2a25ade435
4
- data.tar.gz: b6d8cf5cf2eb4bcaa01b99e2889f4aaa5f0fbbbce6c5663cdaf79bff45dcbc76
3
+ metadata.gz: 9fcbd473bcbc2f8372ac78cfbb6ecebfefb9bc38596f752721a08e3ec2689bfd
4
+ data.tar.gz: 3e5b841dfd1fe4f779da1d12b660d9aa7dbdbc2ad4722ddff71e39f2f4858475
5
5
  SHA512:
6
- metadata.gz: 590f441d103f51d263e8eb073c48f363ffceae3619b52b68360c7bf973daf38cbf3e31c18a0816d61d2f1bddc03207bafa19b4f709535ce1dc67eb7a0694aaa1
7
- data.tar.gz: 247c89c135fa14d90b2e37f67753451cc0c9d945f149bee17186ee8ebdd5faacc87db25e72d682a9a4500659e75c9b79810bec44478816776cefaf0f7a22e17a
6
+ metadata.gz: d51f08a4b7e97bedf2190a40b9f0c0a988a94b72be68f9ab69a6f11a226753a3f64f1fd9c27eb68f02ebf841abd17756135441fab80b1bed6baec9f84c20c991
7
+ data.tar.gz: 5955146ff1666298971a5d31cc165a33cba522c7c9eb325c570e8394759d388911d9890a5229e37eebc71afb8cddb037a3b64d9431d3355f942534fd29c3772f
data/CHANGELOG.md CHANGED
@@ -5,6 +5,30 @@ follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
6
  ## sloplint-judge
7
7
 
8
+ ### [0.3.0] - 2026-11-23
9
+
10
+ - A default `--judge` run now asks the sentence rules about a long paragraph
11
+ that no paragraph rule flagged when a triage question, asked in the same
12
+ paragraph request, finds a sentence doing one of the things they look for.
13
+ Before, a stock figure, an unnamed authority or a verdict in the middle of
14
+ an otherwise plain paragraph was never asked about. The triage question is
15
+ not a rule and makes no note. Default runs send more sentence requests;
16
+ how many more depends on the prose (see docs/JUDGE.md "Cost and speed").
17
+ - `stock-figure` and `device-before-claim` no longer flag a quotation that
18
+ reports what someone said. `device-before-claim` also passes a sentence
19
+ that reports an event or a result, even when it sets two sides against
20
+ each other. Both narrowings cut the notes the triage question added on
21
+ human news by more than half.
22
+ - `stock-figure`'s suggestion now says to keep a figure when the literal
23
+ words lose something, or when the reader's field uses it as the plain name
24
+ for the thing.
25
+ - New paragraph rule `set-piece` (`info`, `medium`): a paragraph with a
26
+ sentence anywhere in it that makes its point through a device -- a
27
+ reversal or mirror built as a line, a slogan, a maxim, a coined figure
28
+ or a payoff line. A line in quotation marks counts when the document
29
+ writes it for someone to say; a quotation reporting what someone already said
30
+ does not.
31
+
8
32
  ### [0.2.0] - 2026-10-13
9
33
 
10
34
  - New sentence rule `positive-form` (`info`, `low`, off by default): a claim
@@ -161,6 +185,29 @@ follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
161
185
 
162
186
  ## sloplint
163
187
 
188
+ ## [0.11.0] - 2026-11-23
189
+
190
+ ### Added
191
+
192
+ - New rule `x-not-y` (false-correction, `warning`, `medium`): the reversed
193
+ corrective, with the true half first and the rejected half after a comma
194
+ ("That's a gap, not a failure."). `not-x-but-y` and `isnt-x-its-y` only
195
+ see the other order.
196
+
197
+ ### Changed
198
+
199
+ - `cleanly` (self-rating, `warning`) now flags every use of the adverb, at
200
+ `high` confidence, including the engineering idiom ("applies cleanly",
201
+ "exited cleanly"). Before, it flagged only some frames, and each
202
+ narrowing missed the next frame.
203
+
204
+ ### Fixed
205
+
206
+ - Under `--markdown`, a line made only of HTML character references, with
207
+ or without tags among them ("&nbsp;", "<br>&#160;"), is dropped. It holds
208
+ no words, so it is not a sentence, and the judge no longer sends it to
209
+ the model. An entity inside running text stays part of its sentence.
210
+
164
211
  ## [0.10.0] - 2026-10-13
165
212
 
166
213
  ### Added
data/README.md CHANGED
@@ -148,7 +148,7 @@ Does not: No parking on Sundays.
148
148
 
149
149
  Everything above is sloplint's 83 **regex rules**: patterns matched against the text, offline, in milliseconds, for nothing. Some tells have no pattern to match. A paragraph that names nothing a reader could check, a sentence that tells its reader what they already know: catching those takes something that can read.
150
150
 
151
- That is the judge, a second catalog of 20 **judge rules** which are questions put to a model rather than patterns. It ships as a companion gem, it turns on with `--judge`, and it needs an API key. Both catalogs write the same notes into the same JSON, so whatever already reads sloplint's output reads the judge's without a change.
151
+ That is the judge, a second catalog of 21 **judge rules** which are questions put to a model rather than patterns. It ships as a companion gem, it turns on with `--judge`, and it needs an API key. Both catalogs write the same notes into the same JSON, so whatever already reads sloplint's output reads the judge's without a change.
152
152
 
153
153
  ### Install it and get a key
154
154
 
@@ -259,13 +259,13 @@ An unknown id or category in `--select`/`--ignore` is a usage error (exit 2, nam
259
259
 
260
260
  The [judge rules](#the-judge-rules) follow these.
261
261
 
262
- 84 rules across nine categories, each named for the rhetorical move the construct makes. `sloplint rules` prints them; `sloplint rules --json` gives an agent the enumerable form.
262
+ 85 rules across nine categories, each named for the rhetorical move the construct makes. `sloplint rules` prints them; `sloplint rules --json` gives an agent the enumerable form.
263
263
 
264
264
  - **self-rating** (16) the writer grades their own prose or claim: `clean-x`, `clean-count`, `cleanest-x`, `cleanly`, `honest-x`, `most-honest-x`, `honestly` (the honesty family, built the same way as the four `clean` rules), `worth-naming`, `worth-saying-plainly`, `earns-its-place`, `does-a-lot-of-work`, `exact-exactly`, `genuinely` (off by default), `the-punchline-is`, `announced-takeaway`, `cataphoric-teaser` (`Here's what nobody tells you`, `the part most people get wrong`).
265
265
  - **closer** (12) closes by restating or announcing the point: `thats-the-whole`, `is-the-whole-x` (the same closer on any subject: `Consistency is the real test.`, at `medium` confidence), `is-the-entire`, `the-entire-is`, `thats-how-x`, `thats-the-tension`, `right-up-until`, `and-nothing-else` (the trailing `…, and nothing else`), `nothing-else-frag`, `bare-equative` (`The lesson is the handoff.`, at `medium` confidence), `trailing-restatement` (the `…, which means …` tail that says the sentence again, off by default), `and-what-it-should` (the elliptical tail: `…, and what it should.`).
266
266
  - **cadence** (20) rhythm: repetition, parallelism, and the long-then-short kicker: `no-x-no-y`, `no-x-no-y-frag`, `did-not-x-did-not-y`, `one-x-one-y` (`one reviewer, one queue, one deadline`), `from-x-to-y-chain` (`from guessing to measuring, from hoping to knowing`), `same-determiner-chain` (any other repeated determiner, at `medium` confidence), `real-x-real-y`, `epistrophe` (off by default), `phrase-echo` (off by default), `is-is` (doubled copula), `the-x-is-the-x` (`the problem with A is the problem with B`), `the-x-is-not-the-x` (any noun split in two by a negated copula: `the job you applied for is not the job you will do`, at `medium` confidence), `rule-of-three` (off by default), `everyone-nobody` (the comma-spliced antithesis: `Everyone wants the dashboard, nobody maintains it.`), `short-run` (three sentences of thirty characters or fewer in a row, at `medium` confidence), `mic-drop-closer` (the short quantifier-led sentence that ends a paragraph after a long one, at `medium` confidence), `bare-auxiliary-closer` (the same shape, but the closer's verb is elided down to a bare auxiliary: `The agent did.`, at `medium` confidence), `np-fragment-and` (the verbless `A named owner and a quarterly review.`, at `medium` confidence), `punch-sentence` (the verbless beat of three words or fewer between two long sentences, `Not anymore.`, at `medium` confidence), `negative-subject` (a negative pronoun as the subject of a clause, dressed up with a paired clause or its own negated relative clause: `nothing gets merged that does not get reviewed.`, at `medium` confidence).
267
267
  - **puffery** (8) inflates the subject: `puffery-words` (`vibrant`, `nestled`, `groundbreaking`, `in the heart of`), `rich-tapestry`, `vital-role`, `stands-serves-as`, `underscores-highlights`, `impact-noun-vague` (`a significant impact`, `make an impact`), `trailing-significance-participle` (the `…, showcasing its importance` clause), `abstract-lives-in` (`the value sits in the follow-up`, at `medium` confidence).
268
- - **false-correction** (8) corrects a reading nobody offered: `not-just-x-but-y`, `not-x-but-y` (the bare corrective), `not-by-x-but-by-y` (`not by luck, but by design`), `isnt-x-its-y` (the same corrective split across two clauses: `It isn't the tool. It's the habit.`), `question-isnt` (the corrective frame in interrogative dress), `less-about-more-about`, `actually-not-x`, `dont-verb-it`.
268
+ - **false-correction** (9) corrects a reading nobody offered: `not-just-x-but-y`, `not-x-but-y` (the bare corrective), `not-by-x-but-by-y` (`not by luck, but by design`), `isnt-x-its-y` (the same corrective split across two clauses: `It isn't the tool. It's the habit.`), `x-not-y` (the same corrective turned round: `That's a gap, not a failure.`), `question-isnt` (the corrective frame in interrogative dress), `less-about-more-about`, `actually-not-x`, `dont-verb-it`.
269
269
  - **false-concession** (7) performs balance or candour and gives nothing up: `two-things-true`, `none-of-this-is-to-say`, `is-real-and-not`, `not-nothing`, `vague-attribution` (`some critics argue`, `it is widely regarded`), `if-im-being-honest` (the candor preamble, from slopwash.com's `false intimacy`), `and-thats-fine`.
270
270
  - **reader-address** (6) instructs or flatters the reader: `you-already-know`, `sit-with-that`, `hold-onto-that`, `notice-what`, `notice-what-there`, `quip-question` (the verbless `No invite?`, at `medium` confidence).
271
271
  - **borrowed-metaphor** (5) an engineering term applied to an argument: `load-bearing`, `failure-mode-here`, `intersection-of`, `impact-verb` (`the outage impacted four thousand accounts`), `impact-noun-bare` (`the impact of X`, at `medium` confidence because research prose uses it straight).
@@ -289,9 +289,9 @@ They run when you name them (`sloplint check --select rule-of-three -`), or when
289
289
 
290
290
  ### The judge rules
291
291
 
292
- Twenty rules in two categories. They run only under `--judge`, because each one costs a request to a model; `sloplint-judge rules` lists them and `sloplint-judge explain ID` prints the question it asks the model, the answer that flags, and the fixtures. The bar differs from the regex catalog's: a judge rule ships when a reader, shown the flagged unit, agrees it should go, whoever wrote it. Severity comes from how sharply the rule separates model prose from human prose. So `throat-clearing` is `info`, not gone: human abstracts open by announcing the paper, and the announcement is dead weight either way.
292
+ Twenty-one rules in two categories. They run only under `--judge`, because each one costs a request to a model; `sloplint-judge rules` lists them and `sloplint-judge explain ID` prints the question it asks the model, the answer that flags, and the fixtures. The bar differs from the regex catalog's: a judge rule ships when a reader, shown the flagged unit, agrees it should go, whoever wrote it. Severity comes from how sharply the rule separates model prose from human prose. So `throat-clearing` is `info`, not gone: human abstracts open by announcing the paper, and the announcement is dead weight either way.
293
293
 
294
- - **paragraph** (6): `particulars`, names nothing a reader could check; `wrap-up`, ends on a summary, a moral or a hope; `throat-clearing`, opens by announcing its topic; `self-narration`, signposts the document instead of advancing it; `promotional`, praises its subject and measures nothing; `same-weight`, states its guesses as flatly as its measurements.
294
+ - **paragraph** (7): `particulars`, names nothing a reader could check; `wrap-up`, ends on a summary, a moral or a hope; `throat-clearing`, opens by announcing its topic; `self-narration`, signposts the document instead of advancing it; `promotional`, praises its subject and measures nothing; `same-weight`, states its guesses as flatly as its measurements; `set-piece`, a sentence in it makes its point through a reversal, mirror, slogan or maxim.
295
295
  - **sentence** (14): `stock-figure`, a stock figure of speech; `no-news`, explains what the reader you declared already knows; `names-nothing`, names nothing specific, and nothing in its paragraph makes its claim checkable; `ends-on-verdict`, ends by grading the fact it just stated; `trailing-gloss`, ends on an -ing clause drawing its own moral; `unnamed-authority`, hands a claim to experts, studies, "many people" or what is "known"; `stated-stakes`, says something matters without saying why; `matched-shape`, a pair or triple built to a rhythm rather than to content; `mirrored-opposites`, opposite words that make two separate claims read as a contrast; `positive-form`, says what something is not where it could say what it is; `name-the-thing`, points at something by position, stand-in or allusion instead of naming it; `maxim`, states a general saying where the fact about this case belongs; `dressed-pair`, one fact dressed as a pair, by an echoed verb or a "both" handed a verdict; `device-before-claim`, makes its claim through a mirror, a riddle, a held-back answer, a coined figure or a maxim instead of stating it plainly.
296
296
 
297
297
  `same-weight`, `stated-stakes`, `matched-shape`, `mirrored-opposites`, `positive-form`, `name-the-thing` and `dressed-pair` are off by default; name them in `--select` or pass `--strict`.
data/docs/SPEC.md CHANGED
@@ -311,7 +311,7 @@ The writer grades their own prose or claim.
311
311
  - `clean-x` — "a clean abstraction/distinction/framing", "clean line between"; `medium` confidence
312
312
  - `clean-count` — "two/three clean parts/buckets/categories…"; needs a partition noun
313
313
  - `cleanest-x` — "the cleanest framing/formulation", "cleanest way to put it"; noun list only
314
- - `cleanly` — "cleanly" into/onto/in two/in half — the partition frame; the preposition is the narrowing; the engineering idiom ("applies cleanly", "separated cleanly", "cleanly compiled") is a checkable fact and stays out, and the clause-final form is left out. `medium` confidence: the frame is not the sense, and separating "splits cleanly into two parts" from "retracted cleanly into the well" needs the subject
314
+ - `cleanly` — every "cleanly", by maintainer ruling; the frame-keyed versions (partition, contest result) each let the next frame through, and the engineering idiom ("applies cleanly", "exited cleanly") is flagged too. `high` confidence
315
315
  - `honest-x` — "an honest comparison", "the honest framing"; short noun list; "answer", "assessment", "account" excluded as ordinary; superlative yielded to the rule below
316
316
  - `most-honest-x` — "the most honest framing", "the most honest way to put it"; wider noun list than `honest-x`; no human nouns, so "the most honest person" stays out
317
317
  - `honestly` — a word, then "honestly", then a full stop or comma; terminal position required; discourse-marker slot guarded ("and/quite/but honestly,"); no animacy test
@@ -388,6 +388,7 @@ Corrects a reading nobody offered.
388
388
  - `not-x-but-y` — the bare corrective "is not X but Y" with no escalation word; `medium` confidence, because the corrective/concession distinction is syntactic and the pattern can only approximate it.
389
389
  - `not-by-x-but-by-y` — the corrective anchored on a repeated preposition rather than a copula: "not by A, but by B", "not from A but from B" (by, for, from, with, about, in, on, at, to, of, through, because of, out of); `medium` confidence. The B side must repeat the A preposition, A is capped at six words, and B may not open with a pronoun. Every corpus hit is the real shape written by a person, which is why it sits at `medium` confidence rather than being narrowed further.
390
390
  - `isnt-x-its-y` — the corrective with no conjunction: a negated copula, then a second clause that supplies the replacement ("It isn't the tool. It's the habit."), joined by a period, semicolon, comma, or dash; `medium` confidence. Neither complement may open with a pronoun, possessive, preposition ("about" excepted), degree word, or predicate adjective, which keeps out ordinary two-part contrast; some hits are still the same shape written by a person.
391
+ - `x-not-y` — the corrective turned round: the true half first and the rejected half trailing after a comma ("That's a collection gap, not a clean bill."); `medium` confidence. The subject is a deictic or an abstract head noun, each half is at most four words and opens lowercase on neither a preposition nor a degree word, the rejected half is not a pronoun and ends the clause. Reference docs use the shape to head off a real misreading.
391
392
  - `question-isnt` — "the question isn't/is not (whether|if|how|what|why|who) X, it's/but Y"; `medium` confidence. The resolving clause is required, so a plain rhetorical question never matches; "the real question is" is excluded.
392
393
  - `less-about-more-about` — "it's/this is/that's less about X (and) more about Y", also "… than about Y"; `medium` confidence. Both halves of the frame are required, and the subject slot is limited to the pronouns.
393
394
  - `actually-not-x` — "actually" and a trailing "…, not X" in one clause; the comma before "not" must be the first comma of the clause and must follow a word, so a fronted setup ("Despite the name, …") and a parenthetical both drop it; never crosses a line break; bare "actually" and "not actually" both left out
@@ -999,50 +999,32 @@ module Sloplint
999
999
  id: "cleanly",
1000
1000
  category: "self-rating",
1001
1001
  severity: "warning",
1002
- confidence: "medium",
1003
- # The bare adverb was the whole rule, and the engineering idioms were
1004
- # flagged on purpose. Technical prose says that was the wrong call: a
1005
- # patch that applies cleanly, a build that compiles cleanly and a gear
1006
- # leg that separates cleanly are all checkable facts with a visible
1007
- # failure state, which is the opposite of rating a fit you haven't
1008
- # shown. The original probe -- 25 Gutenberg texts, no modern manner
1009
- # adverb found -- could not have caught this, because Victorian novels
1010
- # have no builds; the same corpus read as engineering ("clearly and
1011
- # cleanly drawn in pencil", Machine Drawing and Design, 1890) has it.
1012
- #
1013
- # What is left is the partition frame: something divided into parts, or
1014
- # mapped onto another scheme, and rated before the reader sees the
1015
- # parts. The clause-final form ("the objection breaks down cleanly, and
1016
- # neither half survives") is the same tell and is left out.
1017
- #
1018
- # The frame is not the sense, and the confidence here is medium because of it.
1019
- # "The argument splits cleanly into two parts" and "the gear retracted
1020
- # cleanly into the well" are one pattern apart only in their subject,
1021
- # and a regex cannot see the subject -- the same limit that keeps the
1022
- # animacy verbs out of trailing-significance-participle. The preposition
1023
- # buys the common physical cases ("separated cleanly from", "cleanly
1024
- # compiled", "cleanly drawn") and nothing more, so a flag here is a
1025
- # question for the agent reading it, not a verdict.
1026
- pattern: /\bcleanly\s+(?:in(?:to|\s+(?:two|three|half))|onto)\b/i,
1027
- message: '"Cleanly" rates the fit instead of showing it.',
1002
+ confidence: "high",
1003
+ # Every "cleanly", by maintainer ruling. Narrower versions keyed the
1004
+ # rule to a frame -- the partition ("splits cleanly into two"), the
1005
+ # contest result ("lost cleanly") -- and each one let the next frame
1006
+ # through. The engineering idiom ("applies cleanly", "exited cleanly")
1007
+ # is flagged too: a patch that applied or a process that exited says
1008
+ # so without the adverb, and the adverb is the house style of the
1009
+ # prose this tool is pointed at.
1010
+ pattern: /\bcleanly\b/i,
1011
+ message: '"Cleanly" rates the fit or the result instead of showing it.',
1028
1012
  suggestion: "Cut the adverb, or say what actually lined up.",
1029
1013
  examples_bad: [
1030
1014
  "The argument splits cleanly into two parts.",
1031
1015
  "The new taxonomy maps cleanly onto the old one.",
1032
- "The objection divides cleanly in half, and neither side survives."
1016
+ "The objection divides cleanly in half, and neither side survives.",
1017
+ "She ran a full campaign for the new seat and lost cleanly.",
1018
+ "The incumbent won cleanly in the end.",
1019
+ "The patch applies cleanly to main.",
1020
+ "The worker exited cleanly after the last job.",
1021
+ "The parts fit cleanly."
1033
1022
  ],
1034
1023
  examples_ok: [
1035
1024
  "The branch merged without conflicts.",
1036
1025
  "She wiped the counter clean.",
1037
1026
  "The build finished with no warnings.",
1038
- # The engineering idiom the rule used to flag on purpose. A patch that
1039
- # applies cleanly either did or did not; there is nothing being rated.
1040
- "The patch applies cleanly to main.",
1041
- # Wording follows NTSB AAR-14/01 and NASA SEL-84-101 (US government
1042
- # works) and An Introduction to Machine Drawing and Design (1890).
1043
- "The main landing gear separated cleanly from the airplane.",
1044
- "The code should be cleanly compiled beforehand.",
1045
- "Your answers should be clearly and cleanly drawn in pencil."
1027
+ "The worker exited with status 0 after the last job."
1046
1028
  ],
1047
1029
  rationale: "The adverb rates the join instead of showing it, and it rates before the " \
1048
1030
  "reader has anything to check. Real material resists -- the leftover case, " \
@@ -3042,6 +3024,77 @@ module Sloplint
3042
3024
  "contrasts two things this way too, so the rule reports the shape, not a " \
3043
3025
  "verdict."
3044
3026
  ),
3027
+ Rule.new(
3028
+ id: "x-not-y",
3029
+ category: "false-correction",
3030
+ severity: "warning",
3031
+ confidence: "medium",
3032
+ # The corrective turned round: the true half first, the rejected half
3033
+ # trailing after a comma ("That's a collection gap, not a clean bill.").
3034
+ # not-x-but-y and isnt-x-its-y only see the order where the rejection
3035
+ # comes first.
3036
+ #
3037
+ # Narrowed on structure. The subject is a deictic ("that's", "it was",
3038
+ # "this is") or one of the abstract head nouns bare-equative uses ("The
3039
+ # problem is scope, not speed."), so "The meeting is Tuesday, not
3040
+ # Wednesday." has the wrong subject. Neither half may open on a capital
3041
+ # or a digit, which keeps out dates, names and version numbers ("It's
3042
+ # Tuesday, not Wednesday."), nor on a preposition, a degree word or
3043
+ # "just"/"only", and the rejected half may not be a pronoun ("that's
3044
+ # your problem, not mine"). Each half is at most four words, and the
3045
+ # rejected half must end the clause, so a longer contrast that goes on
3046
+ # to explain itself is out.
3047
+ #
3048
+ # Medium confidence. Reference docs write the same shape to head off a
3049
+ # real misreading ("it is a line number, not a file name"), at about one
3050
+ # per million words, and so do people elsewhere. A flag reports the
3051
+ # shape, not a verdict.
3052
+ pattern: /\b(?:(?:that|it|this)['’]s|(?:that|it|this)(?:[ \t]|\r?\n(?!\s*\n))+(?:is|was)
3053
+ |(?-i:[Tt])he(?:[ \t]|\r?\n(?!\s*\n))+
3054
+ (?:tell|point|question|problem|issue|lesson|difference|trick|move|risk|goal|reason|pattern|insight|takeaway|shift|bet|catch|gap|bottleneck|failure|mistake|secret|magic|challenge|tension|trap)
3055
+ (?:[ \t]|\r?\n(?!\s*\n))+(?:is|was))
3056
+ (?:[ \t]|\r?\n(?!\s*\n))+
3057
+ (?>(?:a|an|the)(?:[ \t]|\r?\n(?!\s*\n))+)?
3058
+ (?!(?:actually|just|only|merely|simply|even|because|that|to|in|on|at|for|from|with|by|as|so|yet|always|never|all|too|very|quite|really|necessarily|exactly|much|many|one|least|now|here|there|about|until|unlike|like|if|when|whether)\b)
3059
+ (?-i:[a-z])[\w'’-]*(?>(?:[ \t]+[a-z][\w'’-]*){0,3}),
3060
+ (?:[ \t]|\r?\n(?!\s*\n))+not(?:[ \t]|\r?\n(?!\s*\n))+
3061
+ (?>(?:a|an|the)(?:[ \t]|\r?\n(?!\s*\n))+)?
3062
+ (?!(?:actually|just|only|merely|simply|even|because|that|to|in|on|at|for|from|with|by|as|so|yet|always|never|all|too|very|quite|really|necessarily|exactly|much|many|one|least|now|here|there|about|until|unlike|like|if|when|whether
3063
+ |mine|yours|his|hers|ours|theirs|me|you|him|her|us|them|it|this|those|these)\b)
3064
+ (?-i:[a-z])[\w'’-]*(?>(?:[ \t]+[a-z][\w'’-]*){0,3})
3065
+ (?=[ \t]*(?:[.;!?:]|[—–]|\z|\r?\n))/ix,
3066
+ message: '"X, not Y" corrects a description nobody offered.',
3067
+ suggestion: "State the first half on its own; drop the rejected one.",
3068
+ examples_bad: [
3069
+ "That's a collection gap, not a clean bill.",
3070
+ "It was a gap, not a failure.",
3071
+ "The problem is scope, not speed.",
3072
+ "That's the point, not the bug.",
3073
+ "This is a marathon, not a sprint.",
3074
+ "It was a judgment call, not a bug."
3075
+ ],
3076
+ examples_ok: [
3077
+ # Concrete contrasts with a non-deictic subject, or no copula.
3078
+ "The meeting is Tuesday, not Wednesday.",
3079
+ "Use the v2 endpoint, not v1.",
3080
+ # A capital or a digit is a date, a name or a value.
3081
+ "It's Tuesday, not Wednesday.",
3082
+ "That's 40 minutes, not 30.",
3083
+ # A pronoun in the rejected half is a plain contrast of people.
3084
+ "That's your problem, not mine.",
3085
+ # The rejected half must end the clause.
3086
+ "It was a gap, not a failure of the whole review process as it was designed.",
3087
+ # "not just" belongs to not-just-x-but-y.
3088
+ "It's a gap, not just a delay.",
3089
+ # "actually" belongs to actually-not-x.
3090
+ "Despite the name, it is actually a byte string, not text."
3091
+ ],
3092
+ rationale: "The frame rejects a description nobody proposed, so the sentence sounds " \
3093
+ "like a correction while correcting nobody. It is 'not A but B' turned " \
3094
+ "round, with the true half first and the rejection trailing. Reference " \
3095
+ "writing uses the shape to head off a real misreading, so the rule reports " \
3096
+ "the shape, not a verdict."
3097
+ ),
3045
3098
  Rule.new(
3046
3099
  id: "not-by-x-but-by-y",
3047
3100
  category: "false-correction",
@@ -223,6 +223,10 @@ module Sloplint
223
223
  # here. A sentence that names a tag in running text does not look like
224
224
  # this: "<p> is the tag for a paragraph." has words after the ">".
225
225
  HTML_LINE = %r{\A[ \t]{0,3}</?[A-Za-z][^\n]*>[ \t]*\z}
226
+ # A line that is only character references, with or without tags among
227
+ # them: the "&nbsp;" a template leaves as a spacer, "<br>&#160;". It
228
+ # holds no words, so nothing on it is a sentence.
229
+ ENTITY_LINE = %r{\A[ \t]*(?:(?:&(?:[A-Za-z][A-Za-z0-9]*|\#\d+|\#[xX]\h+);|</?[A-Za-z][^<>\n]*>)[ \t]*)+\z}
226
230
  # The --- that opens YAML front matter. FURNITURE reads it as a
227
231
  # horizontal rule wherever it appears; front matter is the block it
228
232
  # opens, and only on the first line of the file.
@@ -291,7 +295,7 @@ module Sloplint
291
295
  # for as long as the indent holds.
292
296
  code = markdown && ((code && (indented || blank)) || (indented && !item && opens))
293
297
  setext = title[i] || (i.positive? && title[i - 1])
294
- dropped = i < front || code || listed || l.match?(FURNITURE) || (markdown && l.match?(HTML_LINE)) ||
298
+ dropped = i < front || code || listed || l.match?(FURNITURE) || (markdown && (l.match?(HTML_LINE) || l.match?(ENTITY_LINE))) ||
295
299
  (markdown && lone_inline?(l, prose)) || (item && l.match?(CONTINUED)) || setext
296
300
  item = listed || (item && l.match?(CONTINUED))
297
301
  prose = !dropped && !blank
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sloplint
4
- VERSION = "0.10.0"
4
+ VERSION = "0.11.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sloplint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Jackson