Skip to content

Commit

Permalink
Adding PHPMD
Browse files Browse the repository at this point in the history
  • Loading branch information
floriankraemer committed Mar 16, 2024
1 parent fbd02b4 commit 6cacf27
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"firebase/php-jwt": "6.*",
"misantron/dbunit": "dev-master",
"nyholm/psr7": "^1.8",
"phpmd/phpmd": "^2.15",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.9"
Expand Down Expand Up @@ -56,7 +57,9 @@
"cs-check": "phpcs --colors -p src/ tests/",
"cs-fix": "phpcbf --colors src/ tests/",
"test": "phpunit",
"test-coverage": "phpunit --coverage-clover=clover.xml"
"test-coverage": "phpunit --coverage-clover=clover.xml",
"phpmd": "bin/phpmd src/ text phpmd.xml.dist",
"phpmd-baseline": "bin/phpmd --generate-baseline --baseline-file phpmd.baseline.xml src/ text phpmd.xml.dist"
},
"config": {
"sort-packages": true,
Expand Down
7 changes: 7 additions & 0 deletions phpmd.baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<phpmd-baseline>
<violation rule="PHPMD\Rule\Design\CouplingBetweenObjects" file="src/AuthenticationService.php"/>
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Authenticator/JwtAuthenticator.php"/>
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="src/Identifier/Ldap/ExtensionAdapter.php"/>
<violation rule="PHPMD\Rule\UnusedFormalParameter" file="src/Identity/Identity.php"/>
</phpmd-baseline>
22 changes: 22 additions & 0 deletions phpmd.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<ruleset name="My first PHPMD rule set"
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>
PHPMD Rules
</description>

<rule ref="rulesets/codesize.xml" />
<rule ref="rulesets/cleancode.xml" />
<rule ref="rulesets/design.xml">
</rule>
<rule ref="rulesets/naming.xml">
<exclude name="LongVariable"/>
<exclude name="LongClassName"/>
</rule>
<rule ref="rulesets/unusedcode.xml" />
</ruleset>

0 comments on commit 6cacf27

Please sign in to comment.