From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Damien Cassou Newsgroups: gmane.emacs.bugs Subject: bug#37063: 26.2.90; Problems with recent CL support in checkdoc Date: Sat, 17 Aug 2019 13:41:57 +0200 Message-ID: <87imqw10je.fsf@cassou.me> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="82884"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Alex Branham , Lars Ingebrigtsen To: 37063@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 17 13:43:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hyx72-000LO3-1T for geb-bug-gnu-emacs@m.gmane.org; Sat, 17 Aug 2019 13:43:12 +0200 Original-Received: from localhost ([::1]:35626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyx70-0003lh-C8 for geb-bug-gnu-emacs@m.gmane.org; Sat, 17 Aug 2019 07:43:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38548) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyx6t-0003lP-Io for bug-gnu-emacs@gnu.org; Sat, 17 Aug 2019 07:43:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyx6s-00039f-AZ for bug-gnu-emacs@gnu.org; Sat, 17 Aug 2019 07:43:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46559) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hyx6s-00039Y-4d for bug-gnu-emacs@gnu.org; Sat, 17 Aug 2019 07:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hyx6s-0007Ri-0D for bug-gnu-emacs@gnu.org; Sat, 17 Aug 2019 07:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Damien Cassou Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Aug 2019 11:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37063 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.156604213628563 (code B ref -1); Sat, 17 Aug 2019 11:43:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Aug 2019 11:42:16 +0000 Original-Received: from localhost ([127.0.0.1]:55380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hyx68-0007Qc-GN for submit@debbugs.gnu.org; Sat, 17 Aug 2019 07:42:16 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:55496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hyx66-0007QT-21 for submit@debbugs.gnu.org; Sat, 17 Aug 2019 07:42:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38470) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyx64-0003hK-K1 for bug-gnu-emacs@gnu.org; Sat, 17 Aug 2019 07:42:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyx63-0002oh-70 for bug-gnu-emacs@gnu.org; Sat, 17 Aug 2019 07:42:12 -0400 Original-Received: from mail.choca.pics ([2001:bc8:20ab::1]:36108) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hyx62-0002lC-UE for bug-gnu-emacs@gnu.org; Sat, 17 Aug 2019 07:42:11 -0400 Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 2DD5BF1BC17; Sat, 17 Aug 2019 13:42:00 +0200 (CEST) Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id sYU5_XHlvHHQ; Sat, 17 Aug 2019 13:41:59 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 2B0D0F1BC19; Sat, 17 Aug 2019 13:41:59 +0200 (CEST) X-Virus-Scanned: amavisd-new at choca.pics Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id mrf1lu4Ylubv; Sat, 17 Aug 2019 13:41:59 +0200 (CEST) Original-Received: from luz4 (199.138.120.78.rev.sfr.net [78.120.138.199]) by mail.choca.pics (Postfix) with ESMTPSA id D1E1DF1BC17; Sat, 17 Aug 2019 13:41:58 +0200 (CEST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:165255 Archived-At: --=-=-= Content-Type: text/plain In the context of bug#37034, some initial support for CL functions and methods was added to checkdoc. On my code, the changes make checkdoc trigger warnings on perfectly valid code IMO. For example, (cl-defmethod foo ((a list)) "Return A.") Checkdoc complains that LIST should be described. I disagree with that, list is a type, not a argument name. I attach to this bug report a patch introducing test cases to checkdoc-tests.el. If it's not possible to implement full support for CL I prefer that checkdoc doesn't complain even if there is a bug in the docstring rather than checkdoc complains when the docstring is correct. Best, -- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-checkdoc-CL-tests.patch >From d7357884819f8921ff1a27dd3a25bdfd882d1c5a Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Fri, 16 Aug 2019 20:42:26 +0200 Subject: [PATCH] checkdoc CL tests --- test/lisp/emacs-lisp/checkdoc-tests.el | 61 ++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el b/test/lisp/emacs-lisp/checkdoc-tests.el index 1cefc4c366..ee4c1fb5a6 100644 --- a/test/lisp/emacs-lisp/checkdoc-tests.el +++ b/test/lisp/emacs-lisp/checkdoc-tests.el @@ -37,6 +37,67 @@ (insert "(defun foo())") (should-error (checkdoc-defun) :type 'user-error))) +(ert-deftest checkdoc-cl-defmethod-ok () + "Checkdoc should be happy with a simple correct cl-defmethod." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defmethod foo (a) \"Return A.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defmethod-with-types-ok () + "Checkdoc should be happy with a cl-defmethod using types." + (with-temp-buffer + (emacs-lisp-mode) + ;; this method matches if A is the symbol `smthg' and if b is a list: + (insert "(cl-defmethod foo ((a (eql smthg)) (b list)) \"Return A+B.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-key-ok () + "Checkdoc should be happy with a cl-defun using &key." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defun foo (&key a (b 27)) \"Return :A+:B.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-allow-other-keys-ok () + "Checkdoc should be happy with a cl-defun using &allow-other-keys." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defun foo (&key a &allow-other-keys) \"Return :A.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-aux-ok () + "Checkdoc should be happy with a cl-defun using &aux." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defun foo (a b &aux (c (+ a b))) \"Return A and B.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-default-optional-value-ok () + "Checkdoc should be happy with a cl-defun using default values for optional args." + (with-temp-buffer + (emacs-lisp-mode) + ;; B is optional and equals 1+a if not provided. HAS-BS is non-nil + ;; if B was provided in the call: + (insert "(cl-defun foo (a &optional (b (1+ a) has-bs)) \"Return A + B.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defun-with-destructuring-ok () + "Checkdoc should be happy with a cl-defun destructuring its arguments." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(cl-defun foo ((a b &optional c) d) \"Return A+B+C+D.\")") + (checkdoc-defun))) + +(ert-deftest checkdoc-cl-defmethod-with-context-ok () + "Checkdoc should ignore context specializers in a cl-defmethod." + (with-temp-buffer + (emacs-lisp-mode) + ;; A context specializer is used to select the correct method but + ;; doesn't have to appear in the docstring: + (insert "(cl-defmethod foo (a &context (global-var (eql foo))) \"Return A.\")") + (checkdoc-defun))) + (ert-deftest checkdoc-tests--next-docstring () "Checks that the one-argument form of `defvar' works. See the comments in Bug#24998." -- 2.21.0 --=-=-=--