benmatselby / sublime-phpcs

🔍 PHP CodeSniffer, PHP Coding Standard Fixer, Linter, and Mess Detector Support for Sublime Text
Other
814 stars 126 forks source link

OSError: [Errno 20] Not a directory #71

Closed yahyaerturan closed 11 years ago

yahyaerturan commented 11 years ago
$ which phpcs
/usr/bin/phpcs
$ which php-cs-fixer 
/usr/local/bin/php-cs-fixer
$ 

I installed php-codesniffer in Kubuntu apt-get and restarted apache2 service. then install php-cs-fixer via:

$ sudo wget http://cs.sensiolabs.org/get/php-cs-fixer.phar -O /usr/local/bin/php-cs-fixer
$ sudo chmod a+x /usr/local/bin/php-cs-fixer

I am using this with Sublime Text 2 latest and it returns below error:

Traceback (most recent call last):
  File "./sublime_plugin.py", line 362, in run_
  File "./phpcs.py", line 571, in run
  File "./phpcs.py", line 440, in fix_standards_errors
  File "./phpcs.py", line 104, in get_errors
  File "./phpcs.py", line 211, in execute
  File "./phpcs.py", line 214, in parse_report
  File "./phpcs.py", line 125, in shell_out
  File ".\subprocess.py", line 633, in __init__
  File ".\subprocess.py", line 1139, in _execute_child
OSError: [Errno 20] Not a directory
khornberg commented 11 years ago

I'm getting the same error using Ubuntu 12:10 with the same path and permission as yahyaerturan.

benmatselby commented 11 years ago

Hi there

I tested this last night on a fresh Ubuntu 12:10 VM installing php-cs-fixer the way you mentioned and using Sublime Text 2 and cannot replicate this error. Can you please turn on debug, restart ST2 and then paste the debug information in here please.

khornberg commented 11 years ago

Okay. I started up ST2 this morning and get a Errno 13 after changing "show_debug": false, to "show_debug": true, in the default settings.

Then in the ST2 console I get:

[Phpcs] phpcs --report=checkstyle -n --standard=PEAR /home/kyle/Projects/sermon-upload/test.php
[Phpcs] cwd: /home/kyle
[Phpcs] <?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="1.4.4">
 <file name="/home/kyle/Projects/sermon-upload/test.php">
  <error line="5" column="1" severity="error" message="Missing @category tag in file comment" source="PEAR.Commenting.FileComment.MissingTag"/>
  <error line="5" column="1" severity="error" message="Missing @package tag in file comment" source="PEAR.Commenting.FileComment.MissingTag"/>
  <error line="5" column="1" severity="error" message="Missing @author tag in file comment" source="PEAR.Commenting.FileComment.MissingTag"/>
  <error line="5" column="1" severity="error" message="Missing @license tag in file comment" source="PEAR.Commenting.FileComment.MissingTag"/>
  <error line="5" column="1" severity="error" message="Missing @link tag in file comment" source="PEAR.Commenting.FileComment.MissingTag"/>
  <error line="11" column="1" severity="error" message="Doc comment for &quot;$var&quot; missing" source="PEAR.Commenting.FunctionComment.MissingParamTag"/>
  <error line="13" column="1" severity="error" message="Missing @return tag in function comment" source="PEAR.Commenting.FunctionComment.MissingReturn"/>
  <error line="14" column="20" severity="error" message="Opening brace should be on a new line" source="PEAR.Functions.FunctionDeclaration.BraceOnSameLine"/>
 </file>
</checkstyle>

[Phpcs] /usr/local/bin/ fix /home/kyle/Projects/sermon-upload/test.php --verbose --level=all
[Phpcs] cwd: /home/kyle
Traceback (most recent call last):
  File "./sublime_plugin.py", line 362, in run_
  File "./phpcs.py", line 571, in run
  File "./phpcs.py", line 440, in fix_standards_errors
  File "./phpcs.py", line 104, in get_errors
  File "./phpcs.py", line 211, in execute
  File "./phpcs.py", line 214, in parse_report
  File "./phpcs.py", line 125, in shell_out
  File ".\subprocess.py", line 633, in __init__
  File ".\subprocess.py", line 1139, in _execute_child
OSError: [Errno 13] Permission denied

I'm not sure if it matters, the line of /usr/local/bin/ fix /home/kyle/Projects/sermon-upload/test.php --verbose --level=all does not seem to contain the correct command for php-cs-fixer like the first line does for phpcs. I got php-cs-fixer to work by using this command on the command line php-cs-fixer --verbose fix /home/kyle/Projects/sermon-upload/test.php --level=all

I also changed the permissions of the file to 777 and tested it without success.

Let me know if I'm looking the wrong place for the debug information.

benmatselby commented 11 years ago

This looks to be the issue:

/usr/local/bin/ fix /home/kyle/Projects/sermon-upload/test.php --verbose --level=all

The path needs to include the application script, so is your config _php_cs_fixer_executablepath:

"php_cs_fixer_executable_path": "/usr/local/bin/php-cs-fixer"
khornberg commented 11 years ago

That does it. I feel dumb. Thank you for the help though.

Kyle

On Tue, Apr 16, 2013 at 1:10 PM, Ben Selby notifications@github.com wrote:

This looks to be the issue:

/usr/local/bin/ fix /home/kyle/Projects/sermon-upload/test.php --verbose --level=all

The path needs to include the application script, so is your config php_cs_fixer_executable_path:

"php_cs_fixer_executable_path": "/usr/local/bin/php-cs-fixer"

— Reply to this email directly or view it on GitHubhttps://github.com/benmatselby/sublime-phpcs/issues/71#issuecomment-16461608 .

benmatselby commented 11 years ago

No worries, updated the README to be clear.

Does this fix it for you @yahyaerturan?

benmatselby commented 11 years ago

@yahyaerturan I am going to close this, as I believe what is discussed above should fix it for you. If it still isn't working, let me know and we can re-open.