sandhje / vscode-phpmd

VSCode PHP Mess Detector extension
MIT License
15 stars 4 forks source link

An error occured while executing PHP Mess Detector #25

Closed corretge closed 7 years ago

corretge commented 7 years ago

When opens a project I get this error message:

An error occured while executing PHP Mess Detector

Going in deep toggling developer tools

image

/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28 An error occured while executing PHP Mess Detector e.doShow @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28

No more details.

I'm running PHP Mess Detector 1.0.3 on a VSCode Version 1.15.1 (1.15.1) 41abd21afdf7424c89319ee7cb0445cc6f376959 on a Mac OSX 10.12.6 (16G29)

sandhje commented 7 years ago

Thank you for reporting. I do need the verbose logs from the extension though to be able to analyse the issue.

Could you go to "File" > "Preferences" > "Settings" and find the "phpmd.verbose" setting and edit that to "true".

Then go to "view" > "ouput" and select "PHP mess detector" in the dropdown in the panel that opens.

When the extension crashes, please copy the content of the output panel and paste that here.

corretge commented 7 years ago

Done!

[Info - 09:47:40] Language server connection initialized. [Info - 09:47:40] Configuration change triggerd, validating all open documents. [Info - 09:47:40] Creating controller [Info - 09:47:40] New document opened, starting validation. [Info - 09:47:40] PHP Mess Detector validation started for file:///Volumes/develop/alteregoweb/emiliana/app/Http/Middleware/AdminVars.php [Info - 09:47:40] PHP mess detector command not using global PHP, skipping PHP test [Info - 09:47:40] PHP Mess Detector test succesful (PHPMD 2.6.0) [Info - 09:47:40] File /Volumes/develop/alteregoweb/emiliana/app/Http/Middleware/AdminVars.php test successful [Info - 09:47:40] Running phpmd command (~/.composer/vendor/bin/phpmd "/Volumes/develop/alteregoweb/emiliana/app/Http/Middleware/AdminVars.php" xml "~/.composer/vendor/girotecnics/girotecnicsmd/ruleset.xml") [Error - 09:47:40] An error occured during document validation after open with the following message: An error occured, no output was received after executing the phpmd command

When I execute the command in a terminal: ~/.composer/vendor/bin/phpmd "/Volumes/develop/alteregoweb/emiliana/app/Http/Middleware/AdminVars.php" xml "~/.composer/vendor/girotecnics/girotecnicsmd/ruleset.xml"

I get:

Cannot find specified rule-set "~/.composer/vendor/girotecnics/girotecnicsmd/ruleset.xml".

But file already exists: `ls -la ~/.composer/vendor/girotecnics/girotecnicsmd/ruleset.xml

-rw-r--r-- 1 alex admin 1031 Jul 27 11:27 /Users/alex/.composer/vendor/girotecnics/girotecnicsmd/ruleset.xml

There is a particularity, a symbolic link ` /Users/alex/.composer/vendor/girotecnics/girotecnicsmd -> /Volumes/develop/girotecnics/ci/girotecnicsmd

because my global composer.json has

    "repositories": [
        { "type": "path", "url": "/Volumes/develop/girotecnics/ci/girotecnicsmd" }

OK! I found the issue:

~ works for the command but not for ruleset path. With:

"phpmd.rules": "/Users/alex/.composer/vendor/girotecnics/girotecnicsmd/ruleset.xml"

works like a charm.

It's a problem of phpmd, not of your extension. Sorry and thanks to show me how to debug it :)