Skip to content

Instantly share code, notes, and snippets.

@manuelpichler
Created January 9, 2015 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save manuelpichler/3cc1906038cd92a41983 to your computer and use it in GitHub Desktop.
Save manuelpichler/3cc1906038cd92a41983 to your computer and use it in GitHub Desktop.
PHPMD ShortVariable exception list
manu@Samweis PHP_PMD-git $ src/bin/phpmd --version
PHPMD 2.2.0
manu@Samweis PHP_PMD-git $ src/bin/phpmd /tmp/short.php text /tmp/naming.xml
manu@Samweis PHP_PMD-git $
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Naming Rules"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
The Naming Ruleset contains a collection of rules about names - too long, too short, and so forth.
</description>
<rule ref="rulesets/naming.xml/ShortVariable">
<properties>
<property name="exceptions" value="id,q,i,j,v,e,f,fp" />
</properties>
</rule>
</ruleset>
<?php
class Foo
{
public function foo($id) {
return $id * $id;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment