VSCode PHP Mess DetectorFeatures
InstallationTo install the extension: Press Using the built-in PHPMD PHARTo use the built-in PHP mess detector you need to have PHP in your PATH. To test, open a shell or command window and type Using a custom PHPMD PHAR or executableIf you want to customize the default PHP mess detector command, e.g. you have PHP mess detector globally installed through composer or have PHP available on a different location, you can customize the command with the ConfigurationThe following configuration options are available: phpmd.command:Customize the PHP mess detector command. If left empty the built-in PHPMD PHAR archive will be executed and PHP needs to be available on your PATH. If you want to use a different PHPMD PHAR you can customize the command here. Examples:To use PHPMD installed globally with composer on a windows machine set this setting to:
Or to use your own PHPMD PHAR on a custom location:
Security fix in version 1.3.0: Before version 1.3.0 it was possible to set phpmd.unsafeCommand:Customize the PHP mess detector command from workspace settings. This setting is ignored by default if Warning: Please be aware that using this setting opens a possibility for a remote code execution attack. See the explanation at the phpmd.unsafeCommandEnabled:Enable customizing the PHP mess detector command from workspace settings. Default is Warning: Please be aware that enabling this setting opens a possibility for a remote code execution attack. When opening a folder from an untrusted source, the opened folder could have a .vscode folder with a settings.json file defining the phpmd.rules:Customize the PHPMD ruleset files used. This option can also take the path to a custom PHPMD ruleset file. Use VS Code's workspace settings to control the rules or ruleset files per workspace. When setting a path to a ruleset file, and the path starts with "~/" this will be replaced with the OS homedir. The string "${workspaceFolder}" in a path to a ruleset file will be replaced with an absolute path to the folder in the workspace which relates to the file that is being validated. Refer to PHPMD's documentation for more information on the ruleset parameter. Examples:To use only the cleancode ruleset and skip all the others:
Pass a comma seperated list of rulesets:
Pass the path to a ruleset file:
Pass the path to a ruleset file located in the home directory:
Pass the path to a ruleset file located in the workspace folder:
phpmd.verbose:Turn verbose logging on or off. All log entries can be viewed VS Code's output panel. Generally this can be turned off (default) unless you need to troubleshoot problems. Examples:To enable verbose logging:
System requirements
Troubleshooting
ContributingIf you found a bug or can help with adding a new feature to this extension you can submit any code through a pull request. The requirements for a pull request to be accepted are:
Before contributing also make sure you are familiar with VSCode's language server development Install all dependencies with yarn HistorySee client/CHANGELOG.md Acknowledgements
|