Skip to content

Commit

Permalink
Added ddev command shortcuts (#2868)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored Dec 30, 2022
1 parent 3dcbdca commit f2b9b7d
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 46 deletions.
7 changes: 7 additions & 0 deletions .ddev/commands/web/php-cs-fixer
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## Description: run PHP-CS-Fixer
## Usage: php-cs-fixer
## Example: ddev php-cs-fixer <path-to-files>

php vendor/bin/php-cs-fixer fix "$@"
7 changes: 7 additions & 0 deletions .ddev/commands/web/phpcbf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## Description: run PHPCodeBeautifier
## Usage: phpcbf
## Example: ddev phpcbf <path-to-files>

php vendor/bin/phpcbf -s -p --report=full,source,summary "$@"
7 changes: 7 additions & 0 deletions .ddev/commands/web/phpcs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## Description: run PHPCodeSniffer
## Usage: phpcs
## Example: ddev phpcs <path-to-files>

php vendor/bin/phpcs -s -p --report=full,summary "$@"
7 changes: 7 additions & 0 deletions .ddev/commands/web/phpmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## Description: run PHPMD
## Usage: phpmd
## Example: ddev phpmd <path-to-files>

php vendor/bin/phpmd "$@" text .phpmd.dist.xml
7 changes: 7 additions & 0 deletions .ddev/commands/web/phpstan
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## Description: run PHPStan
## Usage: phpstan
## Example: ddev phpstan <path-to-files>

XDEBUG_MODE=off php vendor/bin/phpstan analyze "$@"
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -623,3 +623,7 @@
- dev/sonar*
- .github/workflows/phpunit.yml
- .github/workflows/sonar.yml

'ddev':
- .ddev/*
- .ddev/**/*
93 changes: 47 additions & 46 deletions .phpmd.dist.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<ruleset name="Custom ruleset"
<ruleset name="OpenMage 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"
Expand All @@ -9,22 +9,22 @@
</description>

<!-- UNUSEDCODE
UnusedFormalParameter [fixed]
UnusedLocalVariable
UnusedPrivateField
UnusedPrivateMethod
[?] UnusedFormalParameter
[x] UnusedLocalVariable
[x] UnusedPrivateField
[x] UnusedPrivateMethod
-->
<rule ref="rulesets/unusedcode.xml" />

<!-- CLEANCODE
BooleanArgumentFlag
ElseExpression
ErrorControlOperator
DuplicatedArrayKey
IfStatementAssignment
MissingImport
StaticAccess
UndefinedVariable
[-] BooleanArgumentFlag
[?] ElseExpression
[?] ErrorControlOperator
[x] DuplicatedArrayKey
[ ] IfStatementAssignment
[?] MissingImport
[-] StaticAccess
[?] UndefinedVariable
-->
<rule ref="rulesets/cleancode.xml">
<exclude name="BooleanArgumentFlag" />
Expand All @@ -41,12 +41,12 @@
</rule>

<!-- CONTROVERSIAL
CamelCaseClassName
CamelCaseMethodName
CamelCaseParameterName
CamelCasePropertyName
CamelCaseVariableName
Superglobals
[ ] CamelCaseClassName
[ ] CamelCaseMethodName
[ ] CamelCaseParameterName
[ ] CamelCasePropertyName
[ ] CamelCaseVariableName
[x] Superglobals
-->
<rule ref="rulesets/controversial.xml/CamelCaseMethodName">
<properties>
Expand All @@ -67,31 +67,32 @@
<rule ref="rulesets/controversial.xml/Superglobals" />

<!-- NAMEING
BooleanGetMethodName
ConstantNamingConventions
ConstructorWithNameAsEnclosingClass
LongClassName
ShortClassName
LongVariable
ShortVariable
ShortMethodName
[ ] BooleanGetMethodName
[ ] ConstantNamingConventions
[ ] ConstructorWithNameAsEnclosingClass
[ ] LongClassName
[ ] ShortClassName
[ ] LongVariable
[?] ShortVariable
[ ] ShortMethodName
-->
<rule ref="rulesets/naming.xml/ShortVariable">
<properties>
<property name="exceptions" value="a,b,e,id,idx,io,ip,to,x,y,x1,x2,y1,y2" />
</properties>
</rule>
<rule ref="rulesets/naming.xml/ShortMethodName" />

<!-- DESIGN
CountInLoopExpression
CouplingBetweenObjects
DepthOfInheritance
DevelopmentCodeFragment
EmptyCatchBlock
EvalExpression
ExitExpression
GotoStatement
NumberOfChildren
[-] CountInLoopExpression
[x] CouplingBetweenObjects
[-] DepthOfInheritance
[x] DevelopmentCodeFragment
[x] EmptyCatchBlock
[x] EvalExpression
[x] ExitExpression
[x] GotoStatement
[-] NumberOfChildren
-->
<rule ref="rulesets/design.xml">
<exclude name="CouplingBetweenObjects" />
Expand All @@ -100,16 +101,16 @@
</rule>

<!-- CODESIZE
ExcessiveClassComplexity
ExcessiveClassLength
ExcessiveMethodLength
ExcessiveParameterList
ExcessivePublicCount
CyclomaticComplexity
NPathComplexity
TooManyFields
TooManyMethods
TooManyPublicMethods
[-] ExcessiveClassComplexity
[-] ExcessiveClassLength
[-] ExcessiveMethodLength
[-] ExcessiveParameterList
[-] ExcessivePublicCount
[-] CyclomaticComplexity
[-] NPathComplexity
[-] TooManyFields
[-] TooManyMethods
[-] TooManyPublicMethods
-->
<rule ref="rulesets/codesize.xml">
<exclude name="CyclomaticComplexity" />
Expand Down

0 comments on commit f2b9b7d

Please sign in to comment.