Skip to content

Instantly share code, notes, and snippets.

@bgallagh3r
Created October 31, 2013 19:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bgallagh3r/7255042 to your computer and use it in GitHub Desktop.
Save bgallagh3r/7255042 to your computer and use it in GitHub Desktop.
Comma separated exception list for PHP Mess Detector for short variable names like $id or other valid shortnames. I include this using Sublime PHPcs settings.
{
// other settings
// Execute phpmd
"phpmd_run": true,
// Execute the phpmd on file save
"phpmd_command_on_save": true,
// It seems python/sublime cannot always find the phpmd application
// If empty, then use PATH version of phpmd, else use the set value
"phpmd_executable_path": "c:\\wamp\\bin\\php\\php5.4.12\\pear\\phpmd.bat",
// Additional arguments you can specify into the application
//
// Example:
// {
// "codesize,unusedcode"
// }
"phpmd_additional_args": {
"codesize,unusedcode,naming,~/.phpmd/rules.xml": "" // add path to custom ruleset file here
}
}
<?xml version="1.0"?>
<rule ref="rulesets/naming.xml/ShortVariable" >
<properties>
<property name="exceptions" value="id,em" />
</properties>
</rule>
@bkdotcom
Copy link

for anyone that finds this when searching for a solution.... I only had luck when omitting naming from phpmd_additional_args

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment