Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 10 07:51
    qkdreyer opened #49
  • Jul 10 15:46
    tlorens opened #48
  • Apr 22 18:25
    shane-smith commented #46
  • Apr 03 07:24
    sandhje labeled #47
  • Apr 03 07:24
    sandhje opened #47
  • Apr 03 07:21
    sandhje commented #46
  • Apr 03 07:19
    sandhje closed #41
  • Apr 03 07:19
    sandhje commented #41
  • Apr 03 07:18
    sandhje closed #43
  • Apr 03 07:18
    sandhje commented #43
  • Apr 03 07:15
    sandhje closed #44
  • Apr 03 07:14
    sandhje labeled #45
  • Apr 03 07:14
    sandhje commented #45
  • Apr 03 04:02
    codecov[bot] commented #46
  • Apr 03 04:00
    shane-smith opened #46
  • Mar 27 01:14
    monooso opened #45
  • Dec 24 2018 23:04
    cvetan commented #44
  • Dec 24 2018 23:02
    cvetan commented #44
  • Dec 23 2018 16:43
    sandhje commented #44
  • Dec 21 2018 10:53
    cvetan commented #44
rezashamdani
@rezashamdani
hi, on launching vscode, the phpmd succefully detect 21 problems on a file, yet when i try to fix only 1 problem, the phpmd failed to detect the rest of the problems. it stated 0 problem on the output tab.
[Info - 12:45:17 PM] Language server connection initialized.
[Info - 12:45:17 PM] Configuration change triggerd, validating all open documents.
[Info - 12:45:17 PM] Creating controller
[Info - 12:45:17 PM] New document opened, starting validation.
[Info - 12:45:17 PM] PHP Mess Detector validation started for file:///Users/rezash/Sites/howdenbenefitsasia.local/admin_benefit/get_data.php
[Info - 12:45:17 PM] PHP command test successful (PHP 7.0.19 (cli) ...)
[Info - 12:45:24 PM] PHP Mess Detector test succesful (PHPMD 2.6.0)
[Info - 12:45:24 PM] Running phpmd command (php /Users/rezash/.vscode/extensions/ecodes.vscode-phpmd-1.0.0/phpmd/phpmd.phar /Users/rezash/Sites/howdenbenefitsasia.local/admin_benefit/get_data.php xml ~/Sites/phpmd_config.xml)
[Info - 12:45:24 PM] PHP Mess Detector validation completed for file:///Users/rezash/Sites/howdenbenefitsasia.local/admin_benefit/get_data.php. 21 problems found
[Info - 12:46:54 PM] Document saved, starting validation.
[Info - 12:46:54 PM] PHP Mess Detector validation started for file:///Users/rezash/Sites/howdenbenefitsasia.local/admin_benefit/get_data.php
[Info - 12:46:54 PM] PHP command test successful (PHP 7.0.19 (cli) ...)
[Info - 12:46:54 PM] PHP Mess Detector test succesful (PHPMD 2.6.0)
[Info - 12:46:54 PM] Running phpmd command (php /Users/rezash/.vscode/extensions/ecodes.vscode-phpmd-1.0.0/phpmd/phpmd.phar /Users/rezash/Sites/howdenbenefitsasia.local/admin_benefit/get_data.php xml ~/Sites/phpmd_config.xml)
[Info - 12:46:56 PM] PHP Mess Detector validation completed for file:///Users/rezash/Sites/howdenbenefitsasia.local/admin_benefit/get_data.php. 0 problems found
Sandhjé Bouw
@sandhje
hi @rezashamdani, I would love to help but can't reproduce the problem you're experiencing. The logs don't show anything strange either so if you could send me the php file that's giving you these problems that would be very helpful. (sandhje/vscode-phpmd#12)
Markus Igeland
@Markussss
hey! is there any easy way to disable a few specific rules in phpmd in vscode?
Sandhjé Bouw
@sandhje
Yes, you can use the phpmd.rules setting of the extension to set either rulesets or a phpmd config file. If you set a phpmd config file you get full control over which rules you want to use and wich not.
See this link (https://phpmd.org/documentation/creating-a-ruleset.html) on how to create a phpmd config file.
And see this link (https://phpmd.org/rules/index.html) for the available rules.
See the phpmd.rules section in the extension's readme on how to set the option.
Markus Igeland
@Markussss
@sandhje Ah, I see. I was hoping there was some ezpz way to turn off a single rule, while keeping the default settings, but if that's not possible, I'll just create a new phpmd ruleset. Thanks for the answer!
mischief2175
@mischief2175
Hello, I've just installed this plugin and I'm a little confused as to why it's not working:
[Info - 14:20:43] New document opened, starting validation.
[Info - 14:20:43] PHP Mess Detector validation started for file:///home/mischief/git/test.php
[Info - 14:20:43] PHP command test successful (PHP 7.2.10-0ubun ...)
[Info - 14:20:43] PHP Mess Detector test succesful (PHPMD 2.6.0)
[Info - 14:20:43] File /home/mischief/git/test.php test successful
[Info - 14:20:43] Running phpmd command (php /home/mischief/.vscode/extensions/ecodes.vscode-phpmd-1.1.0/phpmd/phpmd.phar "/home/mischief/git/test.php" xml "cleancode,codesize,controversial,design,unusedcode,naming")
[Error - 14:20:43] An error occured during document validation after open with the following message: An error occured, no output was received after executing the phpmd command
Sandhjé Bouw
@sandhje
Hi, could you try running the phpmd command (php /home/mischief/.vscode/extensions/ecodes.vscode-phpmd-1.1.0/phpmd/phpmd.phar "/home/mischief/git/test.php" xml "cleancode,codesize,controversial,design,unusedcode,naming") in a shell and paste the output here?
mischief2175
@mischief2175
Here you go:
`PHP Fatal error: Uncaught Error: Call to undefined function PHPMD\simplexml_load_string() in phar:///home/mischief/.vscode/extensions/ecodes.vscode-phpmd-1.1.0/phpmd/phpmd.phar/src/main/php/PHPMD/RuleSetFactory.php:551
Stack trace:
#0 phar:///home/mischief/.vscode/extensions/ecodes.vscode-phpmd-1.1.0/phpmd/phpmd.phar/src/main/php/PHPMD/PHPMD.php(208): PHPMD\RuleSetFactory->getIgnorePattern('cleancode,codes...')
#1 phar:///home/mischief/.vscode/extensions/ecodes.vscode-phpmd-1.1.0/phpmd/phpmd.phar/src/main/php/PHPMD/TextUI/Command.php(132): PHPMD\PHPMD->processFiles('/home/mischief/...', 'cleancode,codes...', Array, Object(PHPMD\RuleSetFactory))
#2 phar:///home/mischief/.vscode/extensions/ecodes.vscode-phpmd-1.1.0/phpmd/phpmd.phar/src/main/php/PHPMD/TextUI/Command.php(173): PHPMD\TextUI\Command->run(Object(PHPMD\TextUI\CommandLineOptions), Object(PHPMD\RuleSetFactory))
#3 /home/mischief/.vscode/extensions/ecodes.vscode-phpmd-1.1.0/phpmd/phpmd.phar(19): PHPMD\TextUI\Command::main(Array)
#4 {main}
thrown in phar:///home/mischief/.vscode/extensions/ecodes.vscode-phpmd-1.1.0/phpmd/phpmd.phar/src/main/php/PHPMD/RuleSetFactory.php on line 551`
Derek Pennycuff
@dap6000_twitter
hi everyone. i'd like for each project to have configuration files in the project root. i've got my xml file saved as .php_md.xml in my project root. and in the workspace specific settings i set Phpmd:Rules to ${workspaceRoot}/.php_md.xml and enabled verbose logging. now i get "An error occurred while executing PHP Mess Detector" but i don't get any info beyond that. i'm sure i've ever screwed up the path to the xml file or i've got a typo in my xml file. but i don't know where to find the logs. any tips?
ah, output panel has PHP Mess Detector as an option. i think that's the logging.
Derek Pennycuff
@dap6000_twitter
[Info  - 3:02:43 PM] Running phpmd command (php [/path/to/phar] "/path/to/file.php" xml "${workspaceRoot}/.php_md.xml")
[Error - 3:02:43 PM] An error occured during document validation after open with the following message: An error occured, no output was received after executing the phpmd command
that ${workspaceRoot} string literal probably isn't supposed to be there 0_o
looks like ${workspaceFolder} replaced ${workspaceRoot} a while back
…xml "${workspaceFolder}/.php_md.xml") so that didn't expand either. boo
Derek Pennycuff
@dap6000_twitter
looks like variable substitution isn't supported in settings at all. https://code.visualstudio.com/docs/editor/variables-reference#_common-questions
Derek Pennycuff
@dap6000_twitter
looks like i'll punt on "check project root for config file" behavior for now. i ran the test on the CLI and got an error Premature end of data in tag ruleset line 2 so i'd munged up my XML too. fixed that and CLI worked as expected. set the full path to the file for this workspace and now it's working as expected within vs code as well. needing to put in the full path for each project isn't the end of the world. i can live with that. thanks for giving me a space for some rubber duck debugging. :D
Sandhjé Bouw
@sandhje
Hi Derek,
I see your problem, I'll submit a new issue on github so I can investigate adding some form of variable substitution in the next version when loading the config file.
Sandhjé Bouw
@sandhje
Derek Pennycuff
@dap6000_twitter
awesome. thank you @sandhje.
for what it's worth, the convention of loading a configuration file from the root of a project seems to be part of PHP CS Fixer itself, not the VS Code plugin for it. https://github.com/FriendsOfPHP/PHP-CS-Fixer/#config-file