From 77494628e2bf6edb8cdb3f78784aab880a6b87a2 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 26 Sep 2021 20:20:20 +0200 Subject: [PATCH] checkdoc: Don't add "Commentary" header to test files * lisp/emacs-lisp/checkdoc.el (checkdoc-file-comments-engine): Don't add "Commentary:" header if it looks like a test file. --- lisp/emacs-lisp/checkdoc.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 24e1ae3f097..b3707bb7863 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -2385,8 +2385,13 @@ Code:, and others referenced in the style guide." err (or ;; * Commentary Section - (if (not (lm-commentary-mark)) - (progn + (if (and (not (lm-commentary-mark)) + ;; No need for a commentary section in test files. + (not (string-match + (rx (or (seq (or "-test.el" "-tests.el") string-end) + "/test/" "/tests/")) + (buffer-file-name)))) + (progn (goto-char (point-min)) (cond ((re-search-forward -- 2.39.2