Skip to content

ErrorFormat not Taking #2

Open
Open

Description

@eethann

I don't have a lot to go on here, but the short of it is that the errorformat setting is not taking across files. Results from CodeSniff are not being parsed correctly, and appear like

|| "/mnt/sda9/echoditto/greenstreets/sites/greenstreets/index.php",24,1,error,"Break statement indented incorrectly; expected 6 spaces, found 0",DrupalCodingStandard.

until I run the command

set errorformat+="%f",%l,%c,%t%[a-zA-Z],"%m",%[a-zA-Z0-9_.-],%*[0-9]

from the vim command prompt, in each file.

I tried copying that command into .vimrc as a quickfix, with no luck. I've seen with both PEAR and DrupalCodingStandard standards.

Any ideas what might be going on here and how to fix? Perhaps something around the scoping of that setting for particular filetypes?

Activity

  1. eethann commented on Dec 14, 2011

    @eethann
    ContributorAuthor

    One additional thought: I am using Syntastic. I'll look into whether that might be the culprit.

  2. bpearson commented on Dec 14, 2011

    @bpearson
    Owner

    What version of PHP CodeSniffer are you using? It looks like you are running an older version (based on the error), can you try using:

    set errorformat+="%f",%l,%c,%t%[a-zA-Z],"%m",%[a-zA-Z0-9_.-]

    instead, and let me know if this works?

    If it does not, can you run:
    phpcs --standard={YOUR STANDARD] --report=csv [ANY FILE] | head -n 2

    Paste in the output, please? I am thinking that vim could have stripped the ending of the error and there might be something I am missing.

  3. eethann commented on Dec 15, 2011

    @eethann
    ContributorAuthor

    When I run the set errorformat from the vim command prompt, CodeSniff works from then on for that file. The command has to be re-run for each file, unforuntately. I tried adding to the end of my .vimrc, but no luck. I also just tried disabling Syntastic, to see if it was the culprit, but again no luck.

    PHP_CodeSniffer 1.3.2 stable is installed, just installed via Pear a few days ago.

    Command-line output of phpcs with CSV report is:

    File,Line,Column,Type,Message,Source,Severity
    "/home/ethan/projects/drupal/freegeoip/code/end7_geoip/end7_geoip.module",3,1,error,"The second line in the file doc comment must be \" * @file\"",DrupalCodingStandard.Commenting.FileComment,5
    

    As an additional note, it is worth noting that Syntastic now supports PHPCS as well, so there is a bit of a collision here. There are some things I like better about this modules implementation, namely the use of the QuickFix buffer.

  4. bpearson commented on Dec 15, 2011

    @bpearson
    Owner

    Does any other plugin set errorformat? Can you list the ones that do? (eg. grep -Rns 'set errorformat' ~/.vim* )

    It doesn't look like the version of codesniffer or the error line at this point, but I will keep looking.

  5. bpearson commented on Feb 12, 2012

    @bpearson
    Owner

    Update: I have tried this plugin under Syntastic and Pathogen but I can still not replicate any problems.

  6. bpearson commented on Apr 17, 2014

    @bpearson
    Owner

    Closing since I cannot replicate this issue, I think it most likely caused by a conflicting plugin or an old version of PHPCS, but unsure how to fix if I cannot replicate. Feel free to lodge a new issue with replication steps if this is still a problem.

  7. bpearson commented on Jul 22, 2014

    @bpearson
    Owner

    Actually I can replicate (somewhat intermittently) this issue, but I can make it go away is by running PHPCS on the command line. No clue what the problem is, it appears to be something wrong with the command line but not sure.

  8. added a commit that references this issue on Jan 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions