1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Make checkdoc work with qualified methods

* lisp/emacs-lisp/checkdoc.el (checkdoc--next-docstring): Handle
cl-defmethod in a case of its own.  Check for the presence of
qualifiers, and skip them accordingly until the docstring.

* test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-cl-defmethod-qualified-ok)
(checkdoc-cl-defmethod-with-extra-qualifier-ok)
(checkdoc-cl-defmethod-with-extra-and-nil-args-ok): Add tests for the fix.
This commit is contained in:
Mauro Aranda 2021-03-04 08:34:58 -03:00
parent 2d43522468
commit fd9202304c
2 changed files with 47 additions and 1 deletions

View file

@ -52,6 +52,33 @@
(insert "(cl-defmethod foo ((a (eql smthg)) (b list)) \"Return A+B.\")")
(checkdoc-defun)))
(ert-deftest checkdoc-cl-defmethod-qualified-ok ()
"Checkdoc should be happy with a `cl-defmethod' using qualifiers."
(with-temp-buffer
(emacs-lisp-mode)
(insert "(cl-defmethod test :around ((a (eql smthg))) \"Return A.\")")
(checkdoc-defun)))
(ert-deftest checkdoc-cl-defmethod-with-extra-qualifier-ok ()
"Checkdoc should be happy with a :extra qualified `cl-defmethod'."
(with-temp-buffer
(emacs-lisp-mode)
(insert "(cl-defmethod foo :extra \"foo\" ((a (eql smthg))) \"Return A.\")")
(checkdoc-defun))
(with-temp-buffer
(emacs-lisp-mode)
(insert
"(cl-defmethod foo :extra \"foo\" :after ((a (eql smthg))) \"Return A.\")")
(checkdoc-defun)))
(ert-deftest checkdoc-cl-defmethod-with-extra-qualifier-and-nil-args-ok ()
"Checkdoc should be happy with a 0-arity :extra qualified `cl-defmethod'."
(with-temp-buffer
(emacs-lisp-mode)
(insert "(cl-defmethod foo :extra \"foo\" () \"Return A.\")")
(checkdoc-defun)))
(ert-deftest checkdoc-cl-defun-with-key-ok ()
"Checkdoc should be happy with a cl-defun using &key."
(with-temp-buffer