Subject: bug#76446: [PATCH v2 4/5] Makefile: Add target to run checkdoc on all files

From: Morgan Smith <[email-masked]>
Date: Sun, 23 Feb 2025 14:17:34 -0500

Michael Albinus <[email-masked]> writes:

> Morgan Smith <[email-masked]> writes:
>
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -8,7 +8,7 @@ TESTTARGET=$(patsubst %.el,%.elc,$(TESTSOURCE))
>>
>>  INFOMANUALS=debbugs.info debbugs-ug.info
>>
>> -.PHONY: all build check clean
>> +.PHONY: all build check clean checkdoc
>>  .PRECIOUS: %.elc
>>
>>  %.elc: %.el
>> @@ -26,6 +26,9 @@ doc: $(INFOMANUALS)
>>
>>  build: $(TARGET)
>>
>> +checkdoc: $(SOURCE) $(TESTSOURCE)
>> +	@$(EMACS) -Q --batch -l test/debbugs-checkdoc-config.el $(foreach file,$^,"--eval=(checkdoc-file \"$(file)\")")
>> +
>>  check: build $(TESTTARGET)
>>  	@$(EMACS) -Q --batch -L . -L ./test $(foreach file,$(TESTSOURCE), -l $(file)) -f ert-run-tests-batch-and-exit
>
> This would be wrong. You don't need to load debbugs-helpers.el (it is
> required in *-tests.el) and debbugs-checkdoc-config.el (it isn't related
> to ert tests.
>

I've decided to move debbugs-checkdoc-config.el into a new resources
directory so that's no longer an issue.

I understand that loading 'debbugs-test-helpers.el' isn't needed but I
don't see any harm in doing so.

>> --- /dev/null
>> +++ b/test/debbugs-checkdoc-config.el
>> +  (setq checkdoc-ispell-lisp-words
>> +        '("ChangeLog" "ChangeLogs" "UTF" "alist" "args"
>> +          "armstrong" "backend" "bcc" "bugreport" "cdate" "cedet"
>> +          "coreutils" "cygwin" "debbugs" "debian" "el" "emacs"
>> +          "etags" "freemail" "fsf" "guix" "gw" "henoch" "hu"
>> +          "hyperestraier" "keymap" "magit" "magnus" "maint"
>> +          "maintainer" "maintainer's" "mbox" "mboxes" "minibuffer"
>> +          "moreinfo" "multibyte" "notabug" "paren" "persistency"
>> +          "regexp" "rescan" "rgm" "rmail" "severities" "sexp"
>> +          "solaris" "src" "sublist" "submitter" "submitter's"
>> +          "subproduct" "subqueries" "subquery" "teardown"
>> +          "unarchived" "unibyte" "unreproducible" "url" "util"
>> +          "wishlist" "wontfix" "wsdl" "www" "xsd" "zltuz")))
>
> Same comment here: couldn't it be a ressource file?

Again, why?

> And, more general: Could this file transformed into an ert test?

I mean it could be but then the build dependencies would expand to
include ispell and an appropriate dictionary.

In my opinion linting is not testing and should be optional.

> Best regards, Michael.

>From 89a74c43388187fb342cf41730494e2364b444b5 Mon Sep 17 00:00:00 2001
From: Morgan Smith <[email-masked]>
Date: Fri, 21 Feb 2025 12:52:35 -0500
Subject: [PATCH v3 4/5] Makefile: Add target to run checkdoc on all files

* Makefile: Add target to run checkdoc on all files.
* resources/debbugs-checkdoc-config.el: New file.
---
 Makefile                             |  5 ++-
 resources/debbugs-checkdoc-config.el | 50 ++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 resources/debbugs-checkdoc-config.el

diff --git a/Makefile b/Makefile
index 81d7b5d2f2..da0764ea36 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ TESTTARGET=$(patsubst %.el,%.elc,$(TESTSOURCE))
 
 INFOMANUALS=debbugs.info debbugs-ug.info
 
-.PHONY: all build check clean
+.PHONY: all build check clean checkdoc
 .PRECIOUS: %.elc
 
 %.elc: %.el
@@ -29,6 +29,9 @@ doc: $(INFOMANUALS)
 
 build: $(TARGET)
 
+checkdoc: $(SOURCE) $(TESTSOURCE)
+	@$(EMACS) -Q --batch -l resources/debbugs-checkdoc-config.el $(foreach file,$^,"--eval=(checkdoc-file \"$(file)\")")
+
 check: build $(TESTTARGET)
 	@$(EMACS) -Q --batch -L . -L ./test $(foreach file,$(TESTSOURCE), -l $(file)) --eval '(ert-run-tests-batch-and-exit "$(TESTS)")'
 
diff --git a/resources/debbugs-checkdoc-config.el b/resources/debbugs-checkdoc-config.el
new file mode 100644
index 0000000000..d09b1adfe5
--- /dev/null
+++ b/resources/debbugs-checkdoc-config.el
@@ -0,0 +1,50 @@
+;;; debbugs-checkdoc-config.el --- Configuration for running checkdoc on debbugs -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2025 Free Software Foundation, Inc.
+
+;; Author: Morgan Smith <[email-masked]>
+;; Package: debbugs
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(defvar checkdoc-package-keywords-flag)
+(defvar checkdoc-spellcheck-documentation-flag)
+(defvar checkdoc-ispell-lisp-words)
+
+(with-eval-after-load "checkdoc"
+  (setq checkdoc-package-keywords-flag t)
+  (setq checkdoc-spellcheck-documentation-flag t)
+  (setq checkdoc-ispell-lisp-words
+        '("ChangeLog" "ChangeLogs" "UTF" "alist" "args"
+          "armstrong" "backend" "bcc" "bugreport" "cdate" "cedet"
+          "coreutils" "cygwin" "debbugs" "debian" "el" "emacs"
+          "etags" "freemail" "fsf" "guix" "gw" "henoch" "hu"
+          "hyperestraier" "keymap" "magit" "magnus" "maint"
+          "maintainer" "maintainer's" "mbox" "mboxes" "minibuffer"
+          "moreinfo" "multibyte" "notabug" "paren" "persistency"
+          "regexp" "rescan" "rgm" "rmail" "severities" "sexp"
+          "solaris" "src" "sublist" "submitter" "submitter's"
+          "subproduct" "subqueries" "subquery" "teardown"
+          "unarchived" "unibyte" "unreproducible" "url" "util"
+          "wishlist" "wontfix" "wsdl" "www" "xsd" "zltuz")))
+
+(provide 'debbugs-checkdoc-config)
+
+;;; debbugs-checkdoc-config.el ends here
-- 
2.48.1