benmatselby / sublime-phpcs

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

[sublime] Weird error in console #165

Closed BramRoets closed 7 years ago

BramRoets commented 8 years ago

[Phpcs] /Users//.composer/vendor/bin/phpcs --report=checkstyle -n --standard=PSR2 /..file.php [Phpcs] /Users//.composer/vendor/bin/phpcs --report=checkstyle -n --standard=PSR2 /..file.php [Phpcs] cwd: /* [Phpcs] Valet requires Brew to be installed on your Mac. [Phpcs] Linter found 0 errors [Phpcs] Sniffer found 0 errors

I have no idea what valet has to do with phpcs. (folders are hidden by *)

benmatselby commented 8 years ago

I have no idea what Valet is i'm afraid, so not sure I can help here

BramRoets commented 8 years ago

It's a package also installed by composer. I have no idea why it's called from within phpcs. Do you have any idea why this program is ran by phpcs?

benmatselby commented 8 years ago

I don't, sorry

benmatselby commented 8 years ago

@BramRoets If you run the following just from your command line/terminal

 /Users//.composer/vendor/bin/phpcs --report=checkstyle -n --standard=PSR2 /..file.php

What happens?

BramRoets commented 8 years ago

Output:

`<?xml version="1.0" encoding="UTF-8"?>

`
benmatselby commented 8 years ago

@BramRoets If there are no results, there wouldn't be anything to show in the plugin?

BramRoets commented 8 years ago

Even when there are mistakes, non are show. Example output of a file with mistakes:

`<?xml version="1.0" encoding="UTF-8"?>

`
benmatselby commented 8 years ago

Hi @BramRoets Is that the output in the console of SublimeText or the terminal? If terminal, can you get the output from SublimeText? Also, what configuration do you have in Sublime Text please?

jpmurray commented 7 years ago

I came in to say exactly the same, seems that Valet is breaking things, because running each tools on the terminal will results in the wanted behavior, but running it from sublime-phpcs, it seems like things just won't work.

FYI, @benmatselby, Valet is a quick php server, developped by the guys at Laravel.: https://github.com/laravel/valet/.

Now, here is the sublime console output I have when saving a PHP file (note, I have everything properly activated):

[Phpcs] Project files:
[Phpcs]  Current: None
[Phpcs]  Last Known: None
[Phpcs] No project file defined, therefore skipping reload
[Phpcs] /Users/jpmurray/.composer/vendor/bin/php-cs-fixer fix /Users/jpmurray/Repositories/test/app/User.php --verbose
[Phpcs] /Users/jpmurray/.composer/vendor/bin/php-cs-fixer fix /Users/jpmurray/Repositories/test/app/User.php --verbose
[Phpcs] cwd: /Users/jpmurray
[Phpcs] Valet requires Homebrew to be installed on your Mac.
[Phpcs] /Users/jpmurray/.composer/vendor/bin/phpcbf /Users/jpmurray/Repositories/test/app/User.php --standard=PSR2 -n
[Phpcs] /Users/jpmurray/.composer/vendor/bin/phpcbf /Users/jpmurray/Repositories/test/app/User.php --standard=PSR2 -n
[Phpcs] cwd: /Users/jpmurray
[Phpcs] Valet requires Homebrew to be installed on your Mac.
[Phpcs] php -l -d display_errors=On /Users/jpmurray/Repositories/test/app/User.php
[Phpcs] php -l -d display_errors=On /Users/jpmurray/Repositories/test/app/User.php
[Phpcs] cwd: /Users/jpmurray
[Phpcs] No syntax errors detected in /Users/jpmurray/Repositories/test/app/User.php

[Phpcs] /Users/jpmurray/.composer/vendor/bin/phpcs --report=checkstyle --standard=PSR2 -n /Users/jpmurray/Repositories/test/app/User.php
[Phpcs] /Users/jpmurray/.composer/vendor/bin/phpcs --report=checkstyle --standard=PSR2 -n /Users/jpmurray/Repositories/test/app/User.php
[Phpcs] cwd: /Users/jpmurray/Repositories/test/app
[Phpcs] Valet requires Homebrew to be installed on your Mac.
[Phpcs] /Users/jpmurray/.composer/vendor/bin/phpmd /Users/jpmurray/Repositories/test/app/User.php text codesize,unusedcode,naming
[Phpcs] /Users/jpmurray/.composer/vendor/bin/phpmd /Users/jpmurray/Repositories/test/app/User.php text codesize,unusedcode,naming
[Phpcs] cwd: /Users/jpmurray
[Phpcs] Valet requires Homebrew to be installed on your Mac.
[Phpcs] Linter found 0 errors
[Phpcs] Sniffer found 0 errors
[Phpcs] MessDetector found 0 errors

Current sublime-phpcs settings:

{
    "phpcs_executable_path": "/Users/jpmurray/.composer/vendor/bin/phpcs",
    "php_cs_fixer_executable_path": "/Users/jpmurray/.composer/vendor/bin/php-cs-fixer",
    "php_cs_fixer_on_save": true,
    "phpcbf_executable_path": "/Users/jpmurray/.composer/vendor/bin/phpcbf",
    "phpcbf_on_save": true,
    "phpcs_linter_run": true,
    "phpcs_linter_command_on_save": true,
    "phpmd_run": true,
    "phpmd_command_on_save": true,
    "phpmd_executable_path": "/Users/jpmurray/.composer/vendor/bin/phpmd",
   "show_debug": true,
}
jpmurray commented 7 years ago

Welp, seems like I've found the culprit! Follow this for explanation, but also, installing it just make phpcs work again!

https://packagecontrol.io/packages/Fix%20Mac%20Path

benmatselby commented 7 years ago

Closing as it doesn't seem related to this plugin and there is a workaround above.