Last active
January 24, 2024 17:04
-
-
Save hglattergotz/82801f37ef78e8816cea7f9e3229998b to your computer and use it in GitHub Desktop.
Example of how to customize the ShortVariable rule in PHP Mess Detector
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
<?xml version="1.0" encoding="UTF-8"?> | |
<ruleset name="Custom 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> | |
Customizations for the naming rule sets. Do not include the naming ruleset in the options. | |
This customization pulls all naming rules in and overrides some properties. | |
</description> | |
<rule ref="rulesets/naming.xml"> | |
<!-- To be able to customize a property on the ShortVariable rule it must first be excluded. | |
Does not really make sense, but see https://github.com/phpmd/phpmd/issues/33 for details. --> | |
<exclude name="ShortVariable"/> | |
</rule> | |
<rule ref="rulesets/naming.xml/ShortVariable"> | |
<properties> | |
<!-- Add common variable names that should be excepted from the default minimum property value of 3 --> | |
<property name="exceptions" description="Comma-separated list of exceptions" value="id"/> | |
</properties> | |
</rule> | |
</ruleset> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment