aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Ryde2016-02-25 16:16:37 +1030
committerLars Ingebrigtsen2016-02-25 16:16:37 +1030
commit80c4cfa965fe361884979c4f50ffcb2401bf1032 (patch)
tree678e926caf48544704611829ddf72c0589663dd4
parent75b0a03c09a05e30394b0a51fdeeb5a141155556 (diff)
downloademacs-80c4cfa965fe361884979c4f50ffcb2401bf1032.tar.gz
emacs-80c4cfa965fe361884979c4f50ffcb2401bf1032.zip
Make checkdoc warn about variables described as "True"
* checkdoc.el (checkdoc-this-string-valid-engine): Docstrings for variables "True...", and functions "Return true...", should usually be "non-nil" (bug#15506).
-rw-r--r--lisp/emacs-lisp/checkdoc.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index ecf6f8203a2..e93294d6cc2 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -1638,6 +1638,17 @@ function,command,variable,option or symbol." ms1))))))
1638 ;; * If a user option variable records a true-or-false 1638 ;; * If a user option variable records a true-or-false
1639 ;; condition, give it a name that ends in `-flag'. 1639 ;; condition, give it a name that ends in `-flag'.
1640 1640
1641 ;; "True ..." should be "Non-nil ..."
1642 (when (looking-at "\"\\*?\\(True\\)\\b")
1643 (if (checkdoc-autofix-ask-replace
1644 (match-beginning 1) (match-end 1)
1645 "Say \"Non-nil\" instead of \"True\"? "
1646 "Non-nil")
1647 nil
1648 (checkdoc-create-error
1649 "\"True\" should usually be \"Non-nil\""
1650 (match-beginning 1) (match-end 1))))
1651
1641 ;; If the variable has -flag in the name, make sure 1652 ;; If the variable has -flag in the name, make sure
1642 (if (and (string-match "-flag$" (car fp)) 1653 (if (and (string-match "-flag$" (car fp))
1643 (not (looking-at "\"\\*?Non-nil\\s-+means\\s-+"))) 1654 (not (looking-at "\"\\*?Non-nil\\s-+means\\s-+")))
@@ -1798,6 +1809,16 @@ Replace with \"%s\"? " original replace)
1798 "Probably \"%s\" should be imperative \"%s\"" 1809 "Probably \"%s\" should be imperative \"%s\""
1799 original replace) 1810 original replace)
1800 (match-beginning 1) (match-end 1)))))) 1811 (match-beginning 1) (match-end 1))))))
1812 ;; "Return true ..." should be "Return non-nil ..."
1813 (when (looking-at "\"Return \\(true\\)\\b")
1814 (if (checkdoc-autofix-ask-replace
1815 (match-beginning 1) (match-end 1)
1816 "Say \"non-nil\" instead of \"true\"? "
1817 "non-nil")
1818 nil
1819 (checkdoc-create-error
1820 "\"true\" should usually be \"non-nil\""
1821 (match-beginning 1) (match-end 1))))
1801 ;; Done with functions 1822 ;; Done with functions
1802 ))) 1823 )))
1803 ;;* When a documentation string refers to a Lisp symbol, write it as 1824 ;;* When a documentation string refers to a Lisp symbol, write it as