all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Filipp Gunbin <fgunbin@fastmail.fm>
To: emacs-devel@gnu.org
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Review request (compilation-error-regexp-alist-alist)
Date: Thu, 31 Oct 2019 21:28:25 +0300	[thread overview]
Message-ID: <m2ftj8py5y.fsf@fastmail.fm> (raw)
In-Reply-To: <m2o8xzgvrf.fsf@fastmail.fm> (Filipp Gunbin's message of "Tue, 29 Oct 2019 23:08:20 +0300")

Please review one more patch.

When gradle invokes ant tasks, the output seems to be like from plain
ant.  This patch makes ant regexp more lax:

- Accept filenames that may occur on Cygwin, like c:/test (in addition
  to c:\test)

- Accept optional additional severity level after task name.  Checkstyle
  - a popular ant task - outputs its own severity level.

I'd be grateful if someone could test it on Windows/Cygwin.  I used to
be a Cygwin user, but now don't have access to a Windows machine.

Thanks.

diff --git a/etc/compilation.txt b/etc/compilation.txt
index 4a4a318d03..7cd33bbd7a 100644
--- a/etc/compilation.txt
+++ b/etc/compilation.txt
@@ -49,10 +49,11 @@ The regexps found on http://ant.apache.org/faq.html, and since
 integrated in both Emacsen, were hairy.  The extra two numbers for
 jikes are the ending line and ending column.
 
-    [javac] /src/DataBaseTestCase.java:27: unreported exception ...
-    [javac] /src/DataBaseTestCase.java:49: warning: finally clause cannot complete normally
-    [jikes]  foo.java:3:5:7:9: blah blah
-  [javadoc] c:\MyProject\Polynomial.java:560: error: unknown tag: math
+       [javac] /src/DataBaseTestCase.java:27: unreported exception ...
+       [javac] /src/DataBaseTestCase.java:49: warning: finally clause cannot complete normally
+      [jikes]  foo.java:3:5:7:9: blah blah
+     [javadoc] c:\MyProject\Polynomial.java:560: error: unknown tag: math
+  [checkstyle] [ERROR] /src/Test.java:38: warning: foo: bar
 
 
 * Bash v2
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index b0bb728de0..f412dbcd54 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -181,9 +181,12 @@ compilation-error-regexp-alist-alist
     (aix
      " in line \\([0-9]+\\) of file \\([^ \n]+[^. \n]\\)\\.? " 2 1)
 
+    ;; Checkstyle task may report its own severity level: "[checkstyle] [ERROR] ..."
+    ;; (see AuditEventDefaultFormatter.java in checkstyle sources).
     (ant
-     "^[ \t]*\\[[^] \n]+\\][ \t]*\\(\\(?:[A-Za-z]:\\\\\\)?[^: \n]+\\):\\([0-9]+\\):\\(?:\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\):\\)?\
-\\( warning\\)?" 1 (2 . 4) (3 . 5) (6))
+     "^[ \t]*\\(?:\\[[^] \n]+\\][ \t]*\\)\\{1,2\\}\\(\\(?:[A-Za-z]:\\)?[^: \n]+\\):\
+\\([0-9]+\\):\\(?:\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\):\\)?\\( warning\\)?"
+     1 (2 . 4) (3 . 5) (6))
 
     (bash
      "^\\([^: \n\t]+\\): line \\([0-9]+\\):" 1 2)
diff --git a/test/lisp/progmodes/compile-tests.el b/test/lisp/progmodes/compile-tests.el
index e38c31dd0a..4c2ce83dde 100644
--- a/test/lisp/progmodes/compile-tests.el
+++ b/test/lisp/progmodes/compile-tests.el
@@ -55,11 +55,19 @@ compile-tests--test-regexps-data
      25 nil 8 "errors.c")
     ;; ant
     ("[javac] /src/DataBaseTestCase.java:27: unreported exception ..."
-     13 nil 27 "/src/DataBaseTestCase.java")
+     13 nil 27 "/src/DataBaseTestCase.java" 2)
     ("[javac] /src/DataBaseTestCase.java:49: warning: finally clause cannot complete normally"
-     13 nil 49 "/src/DataBaseTestCase.java")
+     13 nil 49 "/src/DataBaseTestCase.java" 1)
     ("[jikes]  foo.java:3:5:7:9: blah blah"
-     14 (5 . 10) (3 . 7) "foo.java")
+     14 (5 . 10) (3 . 7) "foo.java" 2)
+    ("[javac] c:/cygwin/Test.java:12: error: foo: bar"
+     9 nil 12 "c:/cygwin/Test.java" 2)
+    ("[javac] c:\\cygwin\\Test.java:87: error: foo: bar"
+     9 nil 87 "c:\\cygwin\\Test.java" 2)
+    ;; Checkstyle error, but ant reports a warning (note additional
+    ;; severity level after task name)
+    ("[checkstyle] [ERROR] /src/Test.java:38: warning: foo"
+     22 nil 38 "/src/Test.java" 1)
     ;; bash
     ("a.sh: line 1: ls-l: command not found"
      1 nil 1 "a.sh")
@@ -420,8 +428,8 @@ compile--test-error-line
           (compilation-num-warnings-found 0)
           (compilation-num-infos-found 0))
       (mapc #'compile--test-error-line compile-tests--test-regexps-data)
-      (should (eq compilation-num-errors-found 90))
-      (should (eq compilation-num-warnings-found 35))
+      (should (eq compilation-num-errors-found 92))
+      (should (eq compilation-num-warnings-found 36))
       (should (eq compilation-num-infos-found 26)))))
 
 (ert-deftest compile-test-grep-regexps ()



  reply	other threads:[~2019-10-31 18:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 20:50 Review request (compilation-error-regexp-alist-alist) Filipp Gunbin
2019-10-28 21:43 ` Stefan Monnier
2019-10-28 23:33   ` Filipp Gunbin
2019-10-29  1:13     ` Stefan Monnier
2019-10-29  2:01       ` Filipp Gunbin
2019-10-29 13:17         ` Stefan Monnier
2019-10-29 14:21           ` Filipp Gunbin
2019-10-29 14:51             ` Stefan Monnier
2019-10-29 16:42               ` Filipp Gunbin
2019-10-29 17:14                 ` Stefan Monnier
2019-10-29 20:08                   ` Filipp Gunbin
2019-10-31 18:28                     ` Filipp Gunbin [this message]
2019-10-31 22:16                       ` Stefan Monnier
2019-11-01 12:24                         ` Filipp Gunbin
2019-10-31  2:07     ` Richard Stallman
2019-10-31 12:11       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ftj8py5y.fsf@fastmail.fm \
    --to=fgunbin@fastmail.fm \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.