Question

Im trying to use Php Code Sniffer with Sublime, but in the sublime terminal I get the following every time I try to Sniff a file:

Traceback (most recent call last):
File "./sublime_plugin.py", line 350, in run_
File "./phpcs.py", line 382, in run
File "./phpcs.py", line 270, in run
File "./phpcs.py", line 98, in get_errors
File "./phpcs.py", line 138, in execute
File "./phpcs.py", line 141, in parse_report
File "./phpcs.py", line 106, in shell_out
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied

Looks like there's a permissions issue somewhere, but:

  • I have set phpcs file in /opt/local/lib/php/pear/bin as executable and checked all parent dir's
  • I have set phpcs.py in sublime package dir as executable (though not sure if it needs it), ditto with parent dir's
  • I have checked and I can run phpcs fine on command line. It is in PATH and it does what it is ment to do and returns results with no errors.

Update with output as per ms4py comment - a 'print cmd' at ln 105:

['php', '-l', '-d display_errors=On', u'/Users/pete/projects/portal/apps/frontend/modules/chilled/actions/actions.class.php']
[u'/opt/local/lib/php/pear/bin', '--report=checkstyle', '-n', u'--standard=PEAR', u'/Users/pete/projects/portal/apps/frontend/modules/chilled/actions/actions.class.php']
Was it helpful?

Solution

Putting the comments in this answer and marking as community wiki:

Check this out, here is the fix: github.com/benmatselby/sublime-phpcs/issues/4 – schlamar May 29 '12 at 13:47

Well the setting should link directly to the executable: '/opt/local/lib/php/pear/bin/phpcs' - schlamar May 29 '12 at 14:15

As explained in the github issue there is a new setting in phpcs to fix this issue by allowing the user to provide a path to the php cs executable should Sublime fail to find it automatically:

phpcs_executable_path

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top