aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2021-09-21 19:20:48 +0200
committerStefan Kangas2021-09-21 20:07:30 +0200
commit8f0806da1afa8ba1ca7a65c344b484ac449a82f4 (patch)
tree1c15282bb413ace50e0a51b64469e073640cf714
parent1c73c0b33a9b10cdae1316ad9e0ba861af454b66 (diff)
downloademacs-8f0806da1afa8ba1ca7a65c344b484ac449a82f4.tar.gz
emacs-8f0806da1afa8ba1ca7a65c344b484ac449a82f4.zip
checkdoc: New defvars to disable some warnings
* lisp/emacs-lisp/checkdoc.el (checkdoc--argument-missing-flag) (checkdoc--disambiguate-symbol-flag) (checkdoc--interactive-docstring-flag): New defvars to disable some warnings. These are intended for use with Emacs itself rather than with third-party libraries. (checkdoc-this-string-valid, checkdoc-this-string-valid-engine): Respect above new variables.
-rw-r--r--lisp/emacs-lisp/checkdoc.el52
1 files changed, 42 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index d7975086878..74186631759 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -331,6 +331,35 @@ See Info node `(elisp) Documentation Tips' for background."
331 :type 'boolean 331 :type 'boolean
332 :version "28.1") 332 :version "28.1")
333 333
334;; This is how you can use checkdoc to make mass fixes on the Emacs
335;; source tree:
336;;
337;; (setq checkdoc--argument-missing-flag nil) ; optional
338;; (setq checkdoc--disambiguate-symbol-flag nil) ; optional
339;; (setq checkdoc--interactive-docstring-flag nil) ; optional
340;; Then use `M-x find-dired' ("-name '*.el'") and `M-x checkdoc-dired'
341
342(defvar checkdoc--argument-missing-flag t
343 "Non-nil means warn if arguments are missing from docstring.
344This variable is intended for use on Emacs itself, where the
345large number of libraries means it is impractical to fix all
346of these warnings en masse. In almost any other case, setting
347this to anything but t is likely to be counter-productive.")
348
349(defvar checkdoc--disambiguate-symbol-flag t
350 "Non-nil means ask to disambiguate Lisp symbol.
351This variable is intended for use on Emacs itself, where the
352large number of libraries means it is impractical to fix all
353of these warnings masse. In almost any other case, setting
354this to anything but t is likely to be counter-productive.")
355
356(defvar checkdoc--interactive-docstring-flag t
357 "Non-nil means warn if interactive function has no docstring.
358This variable is intended for use on Emacs itself, where the
359large number of libraries means it is impractical to fix all
360of these warnings masse. In almost any other case, setting
361this to anything but t is likely to be counter-productive.")
362
334;;;###autoload 363;;;###autoload
335(defun checkdoc-list-of-strings-p (obj) 364(defun checkdoc-list-of-strings-p (obj)
336 "Return t when OBJ is a list of strings." 365 "Return t when OBJ is a list of strings."
@@ -1416,12 +1445,13 @@ buffer, otherwise stop after the first error."
1416 (checkdoc-create-error 1445 (checkdoc-create-error
1417 "You should convert this comment to documentation" 1446 "You should convert this comment to documentation"
1418 (point) (line-end-position))) 1447 (point) (line-end-position)))
1419 (checkdoc-create-error 1448 (when checkdoc--interactive-docstring-flag
1420 (if (nth 2 fp) 1449 (checkdoc-create-error
1421 "All interactive functions should have documentation" 1450 (if (nth 2 fp)
1422 "All variables and subroutines might as well have a \ 1451 "All interactive functions should have documentation"
1452 "All variables and subroutines might as well have a \
1423documentation string") 1453documentation string")
1424 (point) (+ (point) 1) t))))) 1454 (point) (+ (point) 1) t))))))
1425 (if (and (not err) (= (following-char) ?\")) 1455 (if (and (not err) (= (following-char) ?\"))
1426 (with-syntax-table checkdoc-syntax-table 1456 (with-syntax-table checkdoc-syntax-table
1427 (checkdoc-this-string-valid-engine fp take-notes)) 1457 (checkdoc-this-string-valid-engine fp take-notes))
@@ -1621,6 +1651,7 @@ mouse-[0-3]\\)\\)\\>"))
1621 (setq mb (match-beginning 1) 1651 (setq mb (match-beginning 1)
1622 me (match-end 1)) 1652 me (match-end 1))
1623 (if (and sym (boundp sym) (fboundp sym) 1653 (if (and sym (boundp sym) (fboundp sym)
1654 checkdoc--disambiguate-symbol-flag
1624 (save-excursion 1655 (save-excursion
1625 (goto-char mb) 1656 (goto-char mb)
1626 (forward-word-strictly -1) 1657 (forward-word-strictly -1)
@@ -1798,11 +1829,12 @@ function,command,variable,option or symbol." ms1))))))
1798 (looking-at "[.?!]"))) 1829 (looking-at "[.?!]")))
1799 (insert ".")) 1830 (insert "."))
1800 nil) 1831 nil)
1801 (checkdoc-create-error 1832 (when checkdoc--argument-missing-flag
1802 (format-message 1833 (checkdoc-create-error
1803 "Argument `%s' should appear (as %s) in the doc string" 1834 (format-message
1804 (car args) (upcase (car args))) 1835 "Argument `%s' should appear (as %s) in the doc string"
1805 s (marker-position e))) 1836 (car args) (upcase (car args)))
1837 s (marker-position e))))
1806 (if (or (and order (eq order 'yes)) 1838 (if (or (and order (eq order 'yes))
1807 (and (not order) checkdoc-arguments-in-order-flag)) 1839 (and (not order) checkdoc-arguments-in-order-flag))
1808 (if (< found last-pos) 1840 (if (< found last-pos)