PHPの静的解析ツールであるphpcsとphpmdの設定ファイルのテンプレートです。
Laravelプロジェクトを作成した時にいつも使っているphpcs.xmlとphpmd.xmlファイルがこちら
<?xml version="1.0"?>
<ruleset name="PSR12/Laravel">
<description>PSR12 compliant rules and settings for Laravel</description>
<arg name="extensions" value="php" />
<rule ref="PSR12" />
<!-- 出力に色を適用 -->
<arg name="colors" />
<!-- オプション p:進捗表示 s:エラー表示時にルールを表示 -->
<arg value="ps" />
<exclude-pattern>/bootstrap/</exclude-pattern>
<exclude-pattern>/config/</exclude-pattern>
<exclude-pattern>/database/</exclude-pattern>
<exclude-pattern>/node_modules/</exclude-pattern>
<exclude-pattern>/public/</exclude-pattern>
<exclude-pattern>/resources/</exclude-pattern>
<exclude-pattern>/routes/</exclude-pattern>
<exclude-pattern>/storage/</exclude-pattern>
<exclude-pattern>/vendor/</exclude-pattern>
<exclude-pattern>/server.php</exclude-pattern>
<exclude-pattern>/app/Console/Kernel.php</exclude-pattern>
<exclude-pattern>/tests/CreatesApplication.php</exclude-pattern>
<rule ref="PSR1.Methods.CamelCapsMethodName">
<file>tests</file>
<exclude-pattern>./tests/*</exclude-pattern>
</rule>
<rule ref="PSR12.Traits.UseDeclaration.MultipleImport">
<exclude-pattern>./*</exclude-pattern>
</rule>
</ruleset>
<?xml version="1.0"?>
<ruleset name="TestMonitor PMD ruleset" 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>TestMonitor PMD ruleset</description>
<rule ref="rulesets/cleancode.xml">
<exclude name="StaticAccess"/>
</rule>
<rule ref="rulesets/codesize.xml">
<exclude name="TooManyMethods"/>
<exclude name="TooManyPublicMethods"/>
</rule>
<rule ref="rulesets/codesize.xml/TooManyMethods">
<properties>
<property name="maxmethods" value="25" description="The method count reporting threshold."/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/TooManyPublicMethods">
<properties>
<property name="maxmethods" value="15" description="The method count reporting threshold."/>
</properties>
</rule>
<rule ref="rulesets/controversial.xml">
<exclude name="CamelCaseMethodName"/>
</rule>
<rule ref="rulesets/design.xml">
<exclude name="NumberOfChildren"/>
</rule>
<rule ref="rulesets/design.xml/NumberOfChildren">
<properties>
<property name="minimum" value="25" description="Maximum number of acceptable child classes."/>
</properties>
</rule>
<rule ref="rulesets/naming.xml">
<exclude name="LongVariable"/>
<exclude name="ShortVariable"/>
<exclude name="BooleanGetMethodName"/>
</rule>
<rule ref="rulesets/unusedcode.xml">
<exclude name="UnusedFormalParameter"/>
</rule>
<exclude-pattern>node_modules</exclude-pattern>
<exclude-pattern>storage</exclude-pattern>
<exclude-pattern>vendor</exclude-pattern>
<exclude-pattern>migrations</exclude-pattern>
</ruleset>
コメントを残す