Wrestling with &errorformat and ISO-8601 timestamps

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Wrestling with &errorformat and ISO-8601 timestamps

Marius Gedminas
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!


[*]  I have this set of plugins[+] that figure out the name of the unit
     test that my cursor is inside, so I can press Ctrl+F9 and run that
     single test in isolation, in the background, with my statusline
     changing color to indicate test running/success/failed, with
     quickfix opening automatically in case of failure.  Ctrl+Shift+F9
     reruns the last test so I can quickly fix the code and see if that
     helped without navigating back to the test.  Life would be utter
     bliss except for this one small annoyance.

[+]  https://github.com/mgedmin/dotvim/blob/master/vimrc

Marius Gedminas
--
I went cold turkey on games early on in college in an attempt to focus; in
retrospect, putting Linux on my primary computer to help enforce that was
likely a valuable career decision.
                -- Evan Martin

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200916071242.ucljn2uuelgh6owu%40blynas.
Reply | Threaded
Open this post in threaded view
|

Re: Wrestling with &errorformat and ISO-8601 timestamps

arocker

> How can I tell Vim that, as a Linux user, I don't believe in file names
> with spaces in them?

They're legal if quoted or escaped - "dummy file" or dummy\ file.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/231bd29d86e2018f624f79ea5aed9971.squirrel%40webmail.vybenetworks.com.
Reply | Threaded
Open this post in threaded view
|

Re: Wrestling with &errorformat and ISO-8601 timestamps

Gary Johnson-4
In reply to this post by Marius Gedminas
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200916175634.GB20505%40phoenix.
Reply | Threaded
Open this post in threaded view
|

Re: Wrestling with &errorformat and ISO-8601 timestamps

Marius Gedminas
On Wed, Sep 16, 2020 at 10:56:34AM -0700, Gary Johnson wrote:

> On 2020-09-16, Marius Gedminas wrote:
> > 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?
>
> 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: ..."

Thank you for that suggestion!

    set errorformat^=%+G%.\ \ %.%#

solved my problem.

Regards,
Marius Gedminas
--
Any sufficiently advanced technology is indistinguishable from a rigged demo.
- Andy Finkel, computer guy

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200917065802.7abo4tyxgym3j2ek%40blynas.