Wednesday, September 16, 2020

Re: Wrestling with &errorformat and ISO-8601 timestamps

On 2020-09-16, Marius Gedminas wrote:
> I like to run Python unit tests using asyncrun.vim[*] and look at the
> results in the quickfix window. One thing that annoys me is that when
> the output contains assertion failures involving ISO-8601 timestamps
> like this one:
>
> E AssertionError: assert 'GitLab proje...tion: 42s\n' == 'GitLab proje...ob created:\n'
> E GitLab project: owner/project
> E - Job created: tbd
> E + Job created: 2020-09-16T06:16:49.180Z
> E + Job started: 2020-09-16T06:16:51.066Z
> E + Job finished: not yet
> E + Job duration: 42s
>
> tests.py:346: AssertionError
>
> Vim thinks there's an error on line 16 of a file named
> "E + Job created: 2020-09-16T06"
>
> How can I tell Vim that, as a Linux user, I don't believe in file names
> with spaces in them? Or, as a compromise with Windows users, that file
> names with multiple sequential spaces are _extremely_ unlikely?
>
> My &errorformat is set as follows in my .vimrc:
>
> set errorformat&
> set errorformat-=%f(%l):%m
> set errorformat+=E\ %#File\ \"%f\"\\,\ line\ %l%.%#
> set errorformat+=File\ \"%f\"\\,\ line\ %l\\,%#%m
>
> The help says %f pays attention to &isfname, which I haven't tweaked
> much:
>
> set isfname-=\=
>
> and it does not include a space AFAICT.
>
> Please help, vim_use@, you're my only hope!

What I have done to avoid these sorts of problems is to put a rule
early in 'errorformat' that matches the unwanted lines and tells Vim
to ignore them. Here's an example of one such rule from my
cppcheck.vim plugin.

set errorformat^=%-G%#:0:\ information:%.%# " Ignores "*:0: information: ..."

See

:help efm-ignore
:help set^=

HTH,
Gary

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200916175634.GB20505%40phoenix.

No comments: