diff options
author | Kevin Ryde <user42@zip.com.au> | 2016-02-25 16:16:37 +1030 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2016-02-25 16:16:37 +1030 |
commit | 80c4cfa965fe361884979c4f50ffcb2401bf1032 (patch) | |
tree | 678e926caf48544704611829ddf72c0589663dd4 /lisp/emacs-lisp | |
parent | 75b0a03c09a05e30394b0a51fdeeb5a141155556 (diff) | |
download | emacs-80c4cfa965fe361884979c4f50ffcb2401bf1032.tar.gz emacs-80c4cfa965fe361884979c4f50ffcb2401bf1032.tar.bz2 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).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 21 |
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)))))) ;; * If a user option variable records a true-or-false ;; condition, give it a name that ends in `-flag'. + ;; "True ..." should be "Non-nil ..." + (when (looking-at "\"\\*?\\(True\\)\\b") + (if (checkdoc-autofix-ask-replace + (match-beginning 1) (match-end 1) + "Say \"Non-nil\" instead of \"True\"? " + "Non-nil") + nil + (checkdoc-create-error + "\"True\" should usually be \"Non-nil\"" + (match-beginning 1) (match-end 1)))) + ;; If the variable has -flag in the name, make sure (if (and (string-match "-flag$" (car fp)) (not (looking-at "\"\\*?Non-nil\\s-+means\\s-+"))) @@ -1798,6 +1809,16 @@ Replace with \"%s\"? " original replace) "Probably \"%s\" should be imperative \"%s\"" original replace) (match-beginning 1) (match-end 1)))))) + ;; "Return true ..." should be "Return non-nil ..." + (when (looking-at "\"Return \\(true\\)\\b") + (if (checkdoc-autofix-ask-replace + (match-beginning 1) (match-end 1) + "Say \"non-nil\" instead of \"true\"? " + "non-nil") + nil + (checkdoc-create-error + "\"true\" should usually be \"non-nil\"" + (match-beginning 1) (match-end 1)))) ;; Done with functions ))) ;;* When a documentation string refers to a Lisp symbol, write it as |