🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.freebsd.doc
Article #81

mandoc-lint-regression.sh: catch new mandoc lint warnings before you commit

#81
From: Wolfram Schneider
Date: Thu, 19 Nov 2026 11:18
46 lines
6189 bytes
Hi,

I wrote a script that finds new "mandoc -T lint" warnings in
manual pages, per git commit. Running mandoc -T lint on a page with
existing warnings does not tell you whether your change made things
better or worse. mandoc-lint-regression.sh lints the old and the new
version of every manual page a commit touches and reports only the
difference: the warnings that were introduced, and the ones that were
fixed. It is a plain /bin/sh script and needs only git, mandoc(1) and
file(1). It works on commits, on uncommitted changes, and on a whole
directory tree.

Some things you can do with it, inside a freebsd-src checkout:

  # check your changes before you commit them
  mandoc-lint-regression.sh unstaged

  # your own commits of the last 90 days, as author or committer
  mandoc-lint-regression.sh -A -D 90

  # all commits of the last 7 days that touch a manual page
  mandoc-lint-regression.sh -D 7

  # which manual pages in the tree have errors? (no style messages)
  mandoc-lint-regression.sh -W error -s .

The exit status is 1 if a new warning was introduced, so the script
also works as a pre-commit hook ("mandoc-lint-regression.sh staged")
and in CI. Checking all manual pages in the tree takes about 15
seconds here.

Download, documentation and more examples:

  https://people.freebsd.org/~wosch/src/mandoc-lint-regression/

Feedback and bug reports are welcome.

Wolfram

--
Wolfram Schneider <wosch@FreeBSD.org> https://wolfram.schneider.org


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <CAMWY7CAaDJPL76H72XJ1AGN49cUGxQe9FmUEHEb9y8v-V5rwAA@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!weretis.net!feeder8.news.weretis.net!news.szaf.org!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!weretis.net!feeder8.news.weretis.net!news.szaf.org!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: Wolfram Schneider <wosch@freebsd.org>
Newsgroups: muc.lists.freebsd.doc
Subject: mandoc-lint-regression.sh: catch new mandoc lint warnings before you commit
Date: Thu, 19 Nov 2026 12:18:25 +0100
Organization: Newsgate at muc.de e.V.
Approved: news-admin@muc.de
Distribution: world
Message-ID: <CAMWY7CAaDJPL76H72XJ1AGN49cUGxQe9FmUEHEb9y8v-V5rwAA@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="49797"; mail-complaints-to="news-admin@muc.de"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1795087124;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 list-id:list-help:list-owner:list-unsubscribe:list-subscribe:  list-post;
	bh=OQoQdV5541ByYlFFDwYmr/E6FrFIqdEpreqjjF1j6fU=;
	b=C8vRcXlGLeg98nLySMyBJ2Txv43VtAHkIkvjpEunpHprHvglwFrvG12DdzSGCJr2iu+NHd
	kuE+VK24EjspwMWZx9aXvkvySb8p54ijyU0DJ638jKWfyaMZgZjRGv4NKqcmlo4wGYCIUZ
	JJr8QEHVrL7xKV76x+LjvrEJBwVSGpY5whNI5Zp2AeFyqNXFKCMnOwger5JvseV6NNxRmk
	gonD1i+pRG3ZjSiVmaLIfvZ+s0QoMqCiIlWbLwG4NGIPtr6ovE2ANdkCx414D2hNTH46Uh
	4yDfRGDAv49DoWayIxtXG/jCAF2WUyB5E0DxH4Kw8qp3aGPZIb31wS19VyWT0Q==
X-Original-To: freebsd-doc@mlmmj.nyi.freebsd.org
Authentication-Results: mx1.freebsd.org;
	dkim=none;
	dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freebsd.org (policy=none);
	arc=pass ("google.com:s=arc-20260327:i=1");
	spf=pass (mx1.freebsd.org: domain of wschnr@googlemail.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=wschnr@googlemail.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795087116; x=1795691916;
        h=content-type:cc:to:subject:message-id:date:from:mime-version
         :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to:content-type;
        bh=OQoQdV5541ByYlFFDwYmr/E6FrFIqdEpreqjjF1j6fU=;
        b=WTCO0Iy/LSmAUE3a5g08zmfakZM1nCbVgNnaJRXOCWwk8EjxWjtBiKRIzyiVnHqsBh
         aNho5URFHcGdMA3HvzFwWx45PLysIhql7UtMh3fpq6XIo8AcUkZdk/fS+KS/B1gYbnKN
         gziv/A5vO5XJ21+s3DYS/7Rftfp6K/ZSd13z/J0VJ56Nk78eRMLLqzi/k3j/q9zB8zep
         a+0/qYbKTJ2L1A61DmVYz0bRad/RPfR3QQFm5xO83FDoor0RW9hPFyK19jRIzrPUy6cB
         A84FNngXY1/ZlNu4Ylu7admit4rViTmFZbhRUU4ZeqKFBpX9F915aNi69rw4YXnBM0HW
         d9UA==
X-Gm-Message-State: APuU4Z8jiXKOD1T2gvxAE9v7a/pmMJsaY/iRGolDyHw3suOsaA6S5F/V
	ugR3JrDw1C+VngDHSiDEpjTrFv7W34ubCfsJGTsA0/Ry+2sA67PGFJWd+yHgAJU8fjJBk/wrQmd
	2mgTQnjm4zsENqGu6hfUu8rpOuy/yw8AMkA==
X-Gm-Gg: AYBFou3+Rb82Jo83TFLacbLx7vDsG0JNBlXL7FsB2ByhpX3aRVROkTOuOvddD8KusGn
	SHfRqfZwmxP+EHZUbnGBlpMC657TI859OkuqXkQpVGkc9aBcZaeYwyuOkfnsRtX5r3+8Sds5rJi
	HrpXNJAxynVelRx4MJnQ4mGGrFjFtRJ0QtubNeGEEP1QSDkPqGYguxAsm6VBwAY7r/kBOYiNc9Z
	cxIC2cZek61Y+wgZ0/rdD+iMFZCnXZ/6Hs65Ic78PasCZoTVjVnSiHPnrJEqTXN9QOlEe/HlFFS
	W3fABqdjn2twnsfUkJLOezPrZEYLnHgemCD7V481vgJQp8IYdHfEThLIh3SWjvYTlPrCl08MDzf
	B8BW7OSdQO6OwN/tlmjHdqgGFEdJPp7jVbciRauI5iu0uVJqhzfZojoxKu+ER7ILh8oiboqGDM4
	6eBGeYaq9kawT5oi33
Precedence: list
X-Gm-Features: Aa3M54qwco-cIe41JsKVNrx8AfWTAagVNaKA62bn9xFQ0MF76ZLXjC9K5IcORDQ
X-Rspamd-Queue-Id: 4jVbZ729Cbz3KG7
X-Spamd-Bar: /
X-Spamd-Result: default: False [-0.90 / 15.00];
	ARC_ALLOW(-1.00)[google.com:s=arc-20260327:i=1];
	FORGED_SENDER(0.30)[wosch@freebsd.org,wschnr@gmail.com];
	R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c];
	DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), No valid DKIM,none];
	MIME_GOOD(-0.10)[text/plain];
	RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.48:from];
	TO_DN_SOME(0.00)[];
	MIME_TRACE(0.00)[0:+];
	ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US];
	RCPT_COUNT_TWO(0.00)[2];
	RCVD_COUNT_ONE(0.00)[1];
	R_DKIM_NA(0.00)[];
	MLMMJ_DEST(0.00)[freebsd-doc@freebsd.org];
	ALIAS_RESOLVED(0.00)[];
	FROM_NEQ_ENVFROM(0.00)[wosch@freebsd.org,wschnr@gmail.com];
	FROM_HAS_DN(0.00)[];
	FREEMAIL_ENVFROM(0.00)[gmail.com];
	TO_MATCH_ENVRCPT_SOME(0.00)[];
	PREVIOUSLY_DELIVERED(0.00)[freebsd-doc@freebsd.org];
	MISSING_XM_UA(0.00)[];
	RCVD_TLS_LAST(0.00)[];
	RCVD_IN_DNSWL_NONE(0.00)[209.85.128.48:from]
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes