Ihor Radchenko <[email protected]> writes: > First, we need to actually resolve the many linter warnings Org mode > has. In particular, checkdoc. > > Then, checkdoc should be relatively easy.
Hello Ihor! I realize my timing is bad with trying to resolve the checkdoc warnings right now. I hope I didn't mess up your refactoring too much by pushing that checkdoc fix yesterday. If you like the attached patch I can push just that. No checkdoc fixes yet! Let me know when you're done refactoring so I can actually use this patch to fix the checkdoc warnings :P. Doesn't make sense for us to both be doing wide sweeping changes at the same time :) No rush! Creating this was already me procrastinating anyways. Thanks, Morgan
>From 5816efdf3a8b2846dce2450fe524350c29caecdb Mon Sep 17 00:00:00 2001 From: Morgan Smith <[email protected]> Date: Sun, 22 Nov 2026 20:40:30 -0500 Subject: [PATCH] Build System: Add heavily customized checkdoc target This is to help us find problems in our docstrings. Currently this says there are 689 warnings but I'm sure some warnings are masked by others making the real number higher. * Makefile (helpall): Document new "checkdoc" target. * mk/checkdoc-config.el: New file. * mk/targets.mk (.PHONY): Add "checkdoc". (checkdoc): New target to run checkdoc. --- Makefile | 1 + mk/checkdoc-config.el | 1093 +++++++++++++++++++++++++++++++++++++++++ mk/targets.mk | 6 +- 3 files changed, 1099 insertions(+), 1 deletion(-) create mode 100644 mk/checkdoc-config.el diff --git a/Makefile b/Makefile index 813125625..28c3a5940 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ help helpall:: helpall:: $(info make test-dirty - check without building first) $(info make compile-dirty - build only stale Org Elisp files) + $(info make checkdoc - run checkdoc to find issues in docstrings) $(info ) $(info Compatibility) $(info =============) diff --git a/mk/checkdoc-config.el b/mk/checkdoc-config.el new file mode 100644 index 000000000..57e4097cc --- /dev/null +++ b/mk/checkdoc-config.el @@ -0,0 +1,1093 @@ +;;; checkdoc-config.el --- Configuration for running checkdoc -*- lexical-binding: t; -*- + +;; Copyright (C) 2026 Free Software Foundation, Inc. + +;; Author: Morgan Smith <[email protected]> + +;; 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: + +(require 'checkdoc) + +;; Checkdoc tries really hard to throw errors and ask for user input. +;; This snippet helps us run it in a batch mode +(when noninteractive + (advice-add 'checkdoc-y-or-n-p + :override + (lambda (question &rest _) + ;; Don't add arguments to end of docstring + (if (string-suffix-p + "documentation to end of doc string?" + question) + nil + t))) + (advice-add 'y-or-n-p :override (lambda (&rest _) t)) + (advice-add 'user-error :override #'warn) + (advice-add 'read-string :override (lambda (&rest _) "BAD_REPLACEMENT"))) + +;; Report errors using path from repository root +(advice-add 'checkdoc-buffer-label :around + (lambda (fun) + (let ((default-directory (locate-dominating-file default-directory "README.org"))) + (funcall fun)))) + +(defun org--checkdoc-batch-directory (directory) + "Run checkdoc on DIRECTORY." + (dolist (file (directory-files directory t (rx ".el" string-end))) + (find-file file) + (checkdoc-batch) + (setq checkdoc-pending-errors nil) + (when-let* ((b (get-buffer checkdoc-diagnostic-buffer))) + (kill-buffer b)))) + +(defun org--checkdoc-autofix-batch-directory (directory) + "Run checkdoc on DIRECTORY and try to fix everything." + ;; Can't run spellcheck with autofix non-interactively + (setq checkdoc-spellcheck-documentation-flag nil) + (setq checkdoc-autofix-flag 'automatic) + (dolist (file (directory-files directory t (rx ".el" string-end))) + (find-file file) + (checkdoc-current-buffer t) + (save-buffer) + (when checkdoc-pending-errors + (when-let* ((b (get-buffer checkdoc-diagnostic-buffer))) + (with-current-buffer b + (princ (buffer-string))) + (terpri)) + (checkdoc-current-buffer)) + (setq checkdoc-pending-errors nil) + (when-let* ((b (get-buffer checkdoc-diagnostic-buffer))) + (kill-buffer b)))) + + + +;; Feel free to turn off some warnings to focus on specific ones! + +;; (setq-default checkdoc-arguments-missing-flag nil) +;; (setq-default checkdoc--disambiguate-symbol-flag nil) +;; (setq-default checkdoc--interactive-docstring-flag nil) +;; (setq-default checkdoc-permit-comma-termination-flag t) +;; (setq checkdoc-force-docstrings-flag nil) +;; (setq checkdoc-allow-quoting-nil-and-t t) +;; (setq checkdoc-column-zero-backslash-before-paren nil) + + + + +;; Other warnings we should fix +;; These are lower priority since they are not enabled by default + +;; (setq checkdoc-package-keywords-flag t) + + +;; experimental things we could try + +;; (setq checkdoc-verb-check-experimental-flag t) + + + +;; spellcheck +;; Spellchecking should be done with an American English dictionary + +;; In warnings we want the exact word including capitilization: +(require 'ispell) +(setq-default ispell-format-word-function #'identity) + +(setq checkdoc-spellcheck-documentation-flag t) + +;; FIXME: I have simply added all flagged words to this list. We need +;; to go through this list to find and remove typos. +(setq checkdoc-ispell-lisp-words + '( + ;; Probably typo's!! + "accesibility" + "accomidate" + "adviced" + "availible" + "checklet" + "consructed" + "constuct" + "Constuct" + "containes" + "correspdonding" + "cumulated" + "encosing" + "erronious" + "finalizer" + "implementated" + "insead" + "Matalab" + "occuping" + "postives" + "prefered" + "recieved" + "recieves" + "recognised" + "recognises" + "scalable" + "separeted" + "Shoud" + "summerize" + "whith" + + ;; American English please! + "behaviour" + "colours" + + "aa" + "aab" + "abbrv" + "abc" + "acm" + "advices" + "AES" + "Alist" + "alist" + "Alists" + "alists" + "allowframebreaks" + "alltodo" + "alsa" + "alsa's" + "Ameli" + "Ameli's" + "ams" + "amsmath" + "amssymb" + "apalike" + "aplay" + "archivedp" + "arg" + "arglist" + "args" + "Aring" + "as" + "asana" + "ascii" + "astro" + "async" + "asyncronicity" + "attr" + "AUCTeX" + "auctex" + "autocompletion" + "Autogenerate" + "autogenerates" + "autokey" + "autonumber" + "autoref" + "autotag" + "Awk" + "awk" + "Babashka" + "babelprovide" + "backaddress" + "Backend" + "backend" + "backends" + "Backport" + "basename" + "bashref" + "basicstyle" + "bb" + "bbdb" + "bdd" + "Beamer" + "beamer" + "bef" + "bfseries" + "bg" + "bgcolor" + "BibLaTeX" + "biblatex" + "BibTeX" + "Bibtex" + "bibtex" + "bitcount" + "BOL" + "Bonum" + "bonum" + "booktabs" + "bt" + "buf" + "BUFFER" + "bugreport" + "bz" + "Calc" + "CamelCase" + "captionable" + "Carsten" + "Carsten's" + "cboff" + "cbon" + "cbtrans" + "cdrs" + "CELL" + "cgi" + "chan" + "charset" + "charsets" + "Checkboxes" + "checkboxes" + "checkitem" + "checksums" + "Citeproc" + "citeproc" + "Citeproc's" + "cleveref" + "clj" + "cljs" + "clockout" + "clockreport" + "clocksum" + "clocktable" + "clocktables" + "clojure" + "ClojureScript" + "cmd" + "cmdline" + "cnames" + "codemirror" + "coderef" + "coderefs" + "colnames" + "colorings" + "columnfractions" + "colview" + "comint" + "commentedp" + "comparator" + "Conf" + "config" + "const" + "CONTENT" + "contrib" + "cp" + "cref" + "crossrefs" + "Csharp" + "csharp" + "CSL" + "csl" + "cslbibitem" + "cslbibliography" + "cslblock" + "cslcitation" + "cslindent" + "cslleftmargin" + "cslrightinline" + "csproj" + "css" + "ctags" + "currentColor" + "currentmonth" + "currentyear" + "CustomFirstColumnTableCell" + "CustomFirstColumnTableParagraph" + "CustomFirstRowTableCell" + "CustomFirstRowTableParagraph" + "customizable" + "Customizations" + "CustomTableCell" + "CustomTableParagraph" + "customtime" + "Cygwin" + "datafile" + "DATAhash" + "datetime" + "datetree" + "dbconnection" + "ddend" + "ddstart" + "de" + "debbugs" + "debounced" + "debouncing" + "decls" + "Decrypt" + "decrypt" + "decrypted" + "decrypting" + "defaultfontfeatures" + "DefineVerbatimEnvironment" + "DejaVu" + "dejavu" + "DELIM" + "dend" + "deps" + "desc" + "detangling" + "dev" + "df" + "dir" + "Dired" + "dirs" + "disambiguates" + "displaymath" + "ditaa" + "DitaaEps" + "dline" + "dll" + "docstring" + "Doctype" + "doctype" + "doctypes" + "documentclass" + "documentencoding" + "documentlanguage" + "DocumentMetadata" + "docview" + "DoeSmithJones" + "doi" + "Dominik" + "dominik" + "dotnet" + "downcased" + "dstart" + "dT" + "dtend" + "dtstart" + "du" + "dui" + "durations" + "dvi" + "dvipng" + "dvips" + "dvisvgm" + "dx" + "eb" + "echo'd" + "edbd" + "EfD" + "efmt" + "el" + "elc" + "Eldoc" + "Elisp" + "elisp" + "elogind" + "elpa" + "emacs" + "Emacsclient" + "emacsclient" + "emacsclient's" + "emacsclients" + "EmacsLink" + "encodeURIComponent" + "encodings" + "endgroup" + "endgrouptag" + "endsalt" + "enduml" + "endXXX" + "english" + "entit" + "env" + "eps" + "eqref" + "erat" + "erroring" + "Eshell" + "eshell" + "euler" + "Eval" + "EvenColumn" + "EvenRow" + "Eww" + "eww" + "exc" + "executables" + "exponentials" + "exps" + "facilisis" + "fancyvrb" + "FAQ" + "feb" + "fermentum" + "ffb" + "filepath" + "filesystem" + "Finalizer" + "findex" + "Fira" + "fira" + "fireforg" + "firefox" + "FirstRow" + "fixnums" + "Fleshout" + "flushright" + "Flyspell" + "flyspell" + "fmt" + "FMTs" + "fn" + "fnadjust" + "foldable" + "foldmarks" + "fontdimen" + "fontenc" + "fontification" + "fontified" + "Fontify" + "fontify" + "fontifying" + "fontsize" + "fontspec" + "footnotemark" + "footnotetext" + "formatter" + "FORMATTERS" + "Fortran" + "fortran" + "FRAGMENT's" + "fromaddress" + "fromname" + "fromto" + "fsf" + "ftnsect" + "func" + "Fusce" + "fvextra" + "fvextra's" + "fvset" + "gcc" + "getSelection" + "getter" + "ghc" + "gif" + "gmail" + "Gnuplot" + "gnuplot" + "gnuvola" + "Goto" + "goto" + "gpg" + "graphicx" + "Grav" + "grey" + "Groff" + "groff" + "grouptags" + "guid" + "gx" + "Gyre" + "HANGINDENT" + "Hardcoded" + "hardcoded" + "haskell" + "hdr" + "hdwmy" + "headlings" + "hellip" + "hfmt" + "hh" + "hideblocks" + "hidedrawers" + "hidestars" + "highlightcolor" + "hk" + "hl" + "hlend" + "hlfmt" + "hline" + "hlines" + "hllend" + "hllfmt" + "hllstart" + "hlstart" + "Hmmm" + "homologue" + "housegordon" + "href" + "hsep" + "htlatex" + "htm" + "html" + "Htmlize" + "htmlize" + "htmlized" + "http" + "https" + "hyperref" + "ia" + "ICAL" + "iCalendar" + "icalendar" + "icount" + "ics" + "idx" + "ieeetr" + "iend" + "ifmt" + "ignoreheading" + "imagemagick" + "Imenu" + "img" + "includegraphics" + "indic" + "infile" + "ini" + "init" + "Inkscape" + "inlined" + "inlinetask" + "Inlinetasks" + "inlinetasks" + "inlining" + "inode" + "inputenc" + "Isearch" + "isearch" + "isep" + "istart" + "itags" + "itemx" + "javac" + "javascript" + "jpeg" + "jpg" + "js" + "julia" + "Karttunen" + "Keymap" + "keymap" + "keymaps" + "keypress" + "keywordstyle" + "kindex" + "klipse" + "kwd" + "ky" + "LABELSEP" + "lang" + "LastColumn" + "LastRow" + "LaTeX" + "latex" + "LaTeXML" + "latexmlc" + "latexmlmath" + "latexpreview" + "latin" + "ldots" + "leo" + "lfmt" + "lhs" + "libnotify" + "ligula" + "LilyPond" + "Lilypond" + "lilypond" + "Linebreak" + "linebreak" + "linebreaks" + "linenr" + "linewidth" + "linkkey" + "linkpreviews" + "linter" + "listoflistings" + "LITERAL" + "llend" + "llfmt" + "llstart" + "ln" + "lns" + "localhost" + "logdone" + "logdrawer" + "logfiles" + "logind" + "lognotedone" + "lognoteredeadline" + "lognoterefile" + "lognoterepeat" + "lognotereschedule" + "logredeadline" + "logrefile" + "logrepeat" + "logreschedule" + "logstatesreversed" + "longtable" + "lstart" + "lstlisting" + "lstlistings" + "ltags" + "Lua" + "LuaLaTeX" + "lualatex" + "ly" + "Mac" + "MacOS" + "macOS" + "MacĂas" + "mailcap" + "mailcaps" + "makefile" + "makeindex" + "manpage" + "matcher" + "matchers" + "mathescape" + "MathJax" + "mathjax" + "MathML" + "MathMl" + "mathp" + "maths" + "MathToWeb" + "mathtoweb" + "matlab" + "Maxima" + "Maxima's" + "maxlevel" + "mc" + "md" + "mdash" + "metaleft" + "metaright" + "mh" + "Minibuffer" + "minibuffer" + "minlevel" + "mobileorg" + "mozilla" + "mtime" + "multicite" + "Multiline" + "multiline" + "multipage" + "multivalued" + "multline" + "multlinewidth" + "mv" + "mylatexformat" + "mystyles" + "namazu" + "NAME" + "NAME's" + "NAMEs" + "namespace" + "natbib" + "natively" + "nav" + "Nbb" + "nbb" + "nd" + "ndash" + "ndays" + "nec" + "newfloat" + "Nextcloud" + "nils" + "nl" + "nntp" + "noabbrev" + "noalign" + "nocite" + "nofnadjust" + "nofold" + "nohideblocks" + "nohidedrawers" + "noindent" + "nolatexpreview" + "nolinkpreviews" + "nologdone" + "nologdrawer" + "nologredeadline" + "nologrefile" + "nologrepeat" + "nologreschedule" + "nologstatesreversed" + "nondigit" + "NonGNU" + "nongnu" + "nonstopmode" + "nonum" + "nonword" + "noop" + "noptag" + "notdeadline" + "notregexp" + "notscheduled" + "nottimestamp" + "nottodo" + "Noweb" + "noweb" + "ns" + "nThis" + "nullary" + "num" + "nux" + "ocaml" + "OddColumn" + "oddeven" + "OddRow" + "ODF" + "odio" + "odt" + "oend" + "ok" + "okular" + "OLD" + "olpath" + "OpenDocument" + "OpenGrok" + "opengrok" + "Org" + "org" + "Org's" + "org's" + "OrgDate" + "OrgEquation" + "orgfile" + "OrgFixedWidthBlock" + "orgmode" + "OrgOdtContentTemplate" + "OrgOdtStyles" + "OrgSrc" + "OrgSrcBlock" + "OrgSrcFontLockFunctionNameFace" + "OrgTbl" + "orgtbl" + "ostart" + "otf" + "ott" + "Outdent" + "outdent" + "outdented" + "outdenting" + "outfile" + "ox" + "packagename" + "pagecolor" + "Pagella" + "pagella" + "PARAGRAPH" + "param" + "params" + "parens" + "pathname" + "pbm" + "pdf" + "pdflatex" + "perl" + "permalink" + "pgm" + "php" + "PlantUML" + "plantuml" + "Plist" + "plist" + "plists" + "png" + "Polyglossia" + "polyglossia" + "pos" + "positionally" + "posix" + "postamble" + "posteo" + "postmatch" + "PostScript" + "pre" + "precompilation" + "Precompile" + "precompile" + "precompiled" + "Precompute" + "preload" + "prematch" + "prepended" + "prepending" + "preprocessing" + "presentationmathml" + "previewable" + "prewarning" + "prewarnings" + "pri" + "proc" + "programmatically" + "Proj" + "PropertyGroup" + "providecommand" + "ps" + "pubDate" + "PUBLISHED" + "px" + "pygmentize" + "pygments" + "pythoncode" + "quis" + "rdmd" + "recurse" + "Redirections" + "referenceable" + "refontification" + "RefTeX" + "regexes" + "reltub" + "reparses" + "representable" + "RequirePackage" + "rf" + "rfc" + "Rmail" + "rnames" + "rnc" + "ROW" + "ROW's" + "rownames" + "rw" + "samp" + "sbe" + "schemas" + "Schola" + "schola" + "Scrlttr" + "scrlttr" + "sdks" + "Sed" + "sed" + "sep" + "sept" + "setdefaultlanguage" + "Setext" + "setfilename" + "setmainlanguage" + "setotherlanguage" + "settitle" + "setupfile" + "Sexp" + "sexp" + "sexps" + "sha" + "shiftmetaleft" + "shiftmetaright" + "shortcaption" + "showeverything" + "showstars" + "siam" + "sidenote" + "siunitx" + "skipcols" + "sln" + "SmithDoe" + "snm" + "Sql" + "sqlcmd" + "Sqlite" + "sqsh" + "Src" + "src" + "ss" + "stackoverflow" + "stanzaskip" + "startgroup" + "startgrouptag" + "startsalt" + "startuml" + "startXXX" + "stdout" + "stix" + "STR" + "str" + "STRUCT" + "STYLE" + "stylesheet" + "subcommands" + "subdirectories" + "subdirectory" + "subentries" + "subentry" + "subexpression" + "subitem" + "sublevels" + "sublist" + "Sublists" + "sublists" + "substrings" + "subtasks" + "Subtree" + "subtree" + "subtreep" + "subtrees" + "sudo" + "summarizable" + "suscipit" + "svg" + "Sybase" + "symlink" + "TABLE" + "TableCell" + "TableParagraph" + "TableWithHeaderColumns" + "TableWithHeaderRowsAndColumns" + "taggable" + "tagindent" + "tagside" + "tagsmatch" + "Taru" + "tblfm" + "tcolorbox" + "td" + "tempfile" + "tempfiles" + "tempor" + "Termes" + "termes" + "tex" + "texfaq" + "texfile" + "Texinfo" + "texinfo" + "texmathp" + "textarea" + "textbf" + "textind" + "texttt" + "TFILE" + "tg" + "th" + "theindex" + "tif" + "tightpage" + "TIME" + "timefmt" + "timegrid" + "timeind" + "timerange" + "timestring" + "tmp" + "tmpfile" + "toaddress" + "toc" + "ToDo" + "todo" + "todos" + "toname" + "toplevel" + "toString" + "tp" + "Transcode" + "transcode" + "transcoded" + "transcoder" + "transcoders" + "transcoding" + "trong" + "tstart" + "tt" + "TTL" + "tue" + "txt" + "TYPEs" + "uend" + "ulem" + "unclosed" + "Uncomment" + "uncomment" + "uncompiled" + "undefer" + "undeferred" + "underbar" + "undoable" + "uneditable" + "unencrypted" + "unescape" + "unfontify" + "Unhexify" + "unhidden" + "Unhide" + "unhide" + "unhides" + "Unhiding" + "unhiding" + "unicode" + "Unmark" + "unnarrowed" + "Unreferenced" + "Unregister" + "unregister" + "unshifted" + "unsrt" + "untagged" + "Upcase" + "upcased" + "uri" + "url" + "URLSearchParams" + "usepackage" + "usr" + "ustart" + "utf" + "uuid" + "uuidgen" + "uva" + "Vertica" + "Viewport" + "viewport" + "Vinny" + "vlines" + "vm" + "vrb" + "vspace" + "WebDAV" + "whitespace" + "whitespaces" + "whitestart" + "Wiegley" + "Windmove" + "wisi" + "wl" + "wor" + "Worg" + "worg" + "wrapfig" + "wrapfigure" + "wrt" + "www" + "X" + "xbm" + "xcolor" + "xdv" + "XeLaTeX" + "xelatex" + "xetex" + "xhtml" + "xlabels" + "xmax" + "xmin" + "xml" + "xpm" + "xprintidle" + "xyz" + "yasnippets" + "ylabels" + "ymax" + "ymin" + "YYYY" + "zr" + )) + + +(provide 'checkdoc-config) + +;;; checkdoc-config.el ends here diff --git a/mk/targets.mk b/mk/targets.mk index e65782ea3..17aaeb917 100644 --- a/mk/targets.mk +++ b/mk/targets.mk @@ -37,7 +37,7 @@ endif cleanlisp cleandoc cleandocs cleantest cleandeps \ compile compile-dirty uncompiled \ config config-test config-exe config-all config-eol config-version \ - vanilla repro + vanilla repro checkdoc CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC CONF_DEST = lispdir infodir datadir testdir @@ -140,6 +140,10 @@ repro: SKIP_CLEANDEPS = yes repro: cleanall autoloads deps -@$(REPRO) & +checkdoc: + $(BATCHO) --eval '(load "../mk/checkdoc-config.el")' \ + --eval '(org--checkdoc-batch-directory "./lisp/")' + $(GITDIR): mkdir -p "$@" -- 2.55.0
