diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-30 17:20:24 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-30 17:20:24 -0500 |
| commit | 1f79945dd4ab386a9ea4ac58fb2161c174a26bba (patch) | |
| tree | 0344827c0793c636a6f1e3f2e3ebc88724ab4f89 /.ai/scripts/tests | |
| parent | 4b24597eee171ccbc5f5fd7067fdd52b87931986 (diff) | |
| download | rulesets-1f79945dd4ab386a9ea4ac58fb2161c174a26bba.tar.gz rulesets-1f79945dd4ab386a9ea4ac58fb2161c174a26bba.zip | |
fix(lint-org): suppress verbatim-asterisk misplaced-heading false positives
org-lint reads an =** Foo= verbatim span in body prose as a possible misplaced heading, but verbatim markup is never a real heading. lint-org kept surfacing these as judgment items, so they recurred in lint-followups.org on every wrap and could never be acted on, since the todo.org content was already correct.
I added lo--verbatim-asterisk-at-line-p, which mirrors the markdown-bold detector: it checks the reported line and the one before it, since org-lint marks the blank line after the offender. A match is now suppressed silently, the same way the cj-comment false positives already are. I flipped the two tests that pinned the old judgment behavior, and confirmed todo.org lints clean (judgment=0). This resolves the checker-bug report I filed in the inbox earlier, which I removed.
Diffstat (limited to '.ai/scripts/tests')
| -rw-r--r-- | .ai/scripts/tests/test-lint-org.el | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/.ai/scripts/tests/test-lint-org.el b/.ai/scripts/tests/test-lint-org.el index 9328064..416f4f6 100644 --- a/.ai/scripts/tests/test-lint-org.el +++ b/.ai/scripts/tests/test-lint-org.el @@ -303,15 +303,16 @@ content (twice (plist-get (lo-test--run lo-test--md-bold 2) :result))) (should (equal once twice)))) -(ert-deftest lo-verbatim-asterisk-is-judgment () +(ert-deftest lo-verbatim-asterisk-is-suppressed () (let* ((out (lo-test--run lo-test--verbatim-asterisk)) (res (plist-get out :result)) (judgments (lo-test--judgments (plist-get out :issues)))) ;; File untouched. (should (equal lo-test--verbatim-asterisk res)) (should (= 0 (plist-get out :fixes))) - ;; Emitted as judgment with the misplaced-heading checker. - (should (member 'misplaced-heading (lo-test--checkers judgments))))) + ;; Verbatim =*** Foo= inside prose is never a real misplaced heading, so it + ;; is suppressed — no judgment emitted (compare the cj-comment suppression). + (should-not (member 'misplaced-heading (lo-test--checkers judgments))))) ;;; --------------------------------------------------------------------------- ;;; Judgment-category emission tests @@ -407,12 +408,12 @@ suspicious-language judgment." (should (string-match-p "CLOSED: \\[2026-05-14\\][^\n]*DEADLINE: <2026-05-20" res)) - ;; Judgment: every flagged broken link, suspicious-language, verbatim-asterisk - ;; emitted untouched. + ;; Judgment: every flagged broken link and suspicious-language emitted untouched. (should (member 'link-to-local-file judgment-checkers)) (should (member 'invalid-fuzzy-link judgment-checkers)) (should (member 'suspicious-language-in-src-block judgment-checkers)) - (should (member 'misplaced-heading judgment-checkers)) + ;; The verbatim-asterisk misplaced-heading is suppressed, not surfaced. + (should-not (member 'misplaced-heading judgment-checkers)) ;; Verbatim-asterisk untouched in the file. (should (lo-test--has res "=*** Foo=")))) |
