Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorFormat not Taking #2

Open
eethann opened this issue Dec 14, 2011 · 7 comments
Open

ErrorFormat not Taking #2

eethann opened this issue Dec 14, 2011 · 7 comments
Assignees

Comments

@eethann
Copy link
Contributor

eethann commented Dec 14, 2011

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?

@eethann
Copy link
Contributor Author

eethann commented Dec 14, 2011

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

@bpearson
Copy link
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.

@ghost ghost assigned bpearson Dec 14, 2011
@eethann
Copy link
Contributor Author

eethann commented Dec 15, 2011

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.

@bpearson
Copy link
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.

@bpearson
Copy link
Owner

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

@bpearson
Copy link
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.

@bpearson bpearson reopened this Jul 22, 2014
@bpearson
Copy link
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.

crowcrow pushed a commit to crowcrow/vim-phpcs that referenced this issue Jan 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants