Wednesday, September 10, 2014

Re: Errorformat - removing useless lines

On 10 September 2014, David Fishburn <dfishburn.vim@gmail.com> wrote:
> Vim 7.4.1-373
>
> I am creating a compiler for some customized ESLint output.
>
> I get lines like this:
>
> >>> Start checking list.js ...
> 27 Errors:
> ESLINT(no-undef):list.js:12:4:ERROR:HIGH:Variable:'gCurrentFilteredTable'
> is not defined.(http://eslint.org/docs/rules/no-undef)
> 34 Warnings:
> ESLINT(no-undefined):list.js:12:28:WARNING:LOW:Variable:Unexpected use of
> undefined.(http://eslint.org/docs/rules/no-undefined)
> 118 Infos:
> ESLINT(quotes):list.js:4:28:INFO:INFO:Stylistic Issue:Strings must use
> doublequote.(http://eslint.org/docs/rules/quotes)
> <<< ... JSLint4SAP v3.0 detected issues (Details:
> https://wiki.wdf.sap.corp/wiki/display/Oberon/JavaScriptChecks).

What is the equivalent of "mojibake" for mail messages? :) It's hard
to tell from your HTML-encumbered message where the original linebreaks
are. Oh well.

> From that output, the following lines I just want to be ignored:
> >>> Start checking list.js ...
> 27 Errors:
> 34 Warnings:
> 118 Infos:
> <<< ... JSLint4SAP v3.0 detected issues (Details:
> https://wiki.wdf.sap.corp/wiki/display/Oberon/JavaScriptChecks).
>
>
> The best I could come up with was the following:
> \%A>>>%.%#.,
> \%A%*\\d\ Errors:,
> \%A%*\\d\ Warnings:,
> \%A%*\\d\ Infos:,
> \%A<<<%.%#.,
>
> This works, but in the cwindow I am left with this output for each of the
> above lines:
> ||
>
> That is 2 bars with a space after them.

That's because %A produce error lines. Use %-G to ignore things; in
particular, %-G%.%# at the end of list ignores everything not matched up
to that point.

> For the parsing of the useful lines I am using:
> \%EESLINT%*[^:]:%f:%l:%c:ERROR:HIGH:%m,
> \%WESLINT%*[^:]:%f:%l:%c:WARNING:MEDIUM:%m,
> \%WESLINT%*[^:]:%f:%l:%c:WARNING:LOW:%m,
> \%IESLINT%*[^:]:%f:%l:%c:INFO:INFO:%m
>
> Which are working well.
>
> So the complete errorformat is:
> CompilerSet errorformat=
> \%A>>>%.%#.,
> \%A%*\\d\ Errors:,
> \%A%*\\d\ Warnings:,
> \%A%*\\d\ Infos:,
> \%A<<<%.%#.,
> \%EESLINT%*[^:]:%f:%l:%c:ERROR:HIGH:%m,
> \%WESLINT%*[^:]:%f:%l:%c:WARNING:MEDIUM:%m,
> \%WESLINT%*[^:]:%f:%l:%c:WARNING:LOW:%m,
> \%IESLINT%*[^:]:%f:%l:%c:INFO:INFO:%m
>
> Would just love to get rid of those "|| " lines in the output.

Assuming there are no continuation lines in the output of your
compiler, how about something like this:

let errorformat =
\ '%EESLINT%*[^:]:%f:%l:%c:ERROR:HIGH:%m,' .
\ '%WESLINT%*[^:]:%f:%l:%c:WARNING:MEDIUM:%m,' .
\ '%WESLINT%*[^:]:%f:%l:%c:WARNING:LOW:%m,' .
\ '%IESLINT%*[^:]:%f:%l:%c:INFO:INFO:%m,' .
\ '%-G%.%#'

> I have tried using %C on them, but that messes up the remainder of the
> parsing.

If you do need continuation lines, and if you do control the
format of the compiler's output, then it's probably useful to mark the
continuations is some way, f.i. by indentation. Then you can use %C on
the indented lines.

/lcd

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment