Created
July 27, 2018 13:41
-
-
Save lynxtdc/456510adfa9b19168ece04a73ebbe579 to your computer and use it in GitHub Desktop.
Down and Dirty Guide to Installing PHP Mess Detector on OS-X and Integrating with PHPStorm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Download PHP Mess Detector PHAR | |
wget -c http://static.phpmd.org/php/latest/phpmd.phar | |
Move the PHAR and "install it" | |
sudo mv phpmd.phar /usr/local/bin/phpmd | |
sudo chmod +x /usr/local/bin/phpmd | |
Check to make sure it's running on your system | |
type phpmd at the command prompt and you should get back a list of Mandatory and Optional arguments | |
To associate with PHPStorm: | |
type which phpmd at the command line and copy the resulting path. | |
In PHPStorm | |
1) Navigate to Preferences->Languages & Frameworks -> PHP -> Mess Detector and click the ... icon in the Development Environment and paste your copied path. | |
2) Navigate to Editor->Inspections and expand PHP, from there, enable PHP Mess Detector validation | |
To use from command line: | |
phpmd /path/to/file/to/inspect <format (default is xml, can also do text or html)> <arguments (most common are: codesize, unusedcode, naming) | |
--- phpmd /path/to/source text codesize,unusedcode,nameing --- is the proper input format | |
To run from PHPStorm goto Code | Inspect Code on the main menu and follow the prompts from there | |
You can also create your own rule sets, see https://phpmd.org for more info. | |
See https://www.jetbrains.com/help/phpstorm/using-php-mess-detector.html for more info on installing and running inside PHPStorm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment