Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
96 changed files
with
3,978 additions
and
2,068 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# This is a git pre-commit hook that prevents a commit from being created if the code style isn't proper | ||
|
||
# first we get everything we need to check, which are the staged changes | ||
CHANGES=$(git diff --name-status --cached) | ||
|
||
# if the changelist contains .php files, run php-cs-fixer in the PHP container | ||
if echo "$CHANGES" | grep -q -E "^[AMCR].+(\.php)$"; then | ||
echo "Running PHP QA checks..." | ||
ddev exec -s web .build/bin/phpcs | ||
ddev exec -s web .build/bin/phpmd Classes/ ansi .phpmd.xml | ||
|
||
if [[ $? -ne 0 ]]; then | ||
exit 1 | ||
fi | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
if [ -e .git/hooks/pre-commit ]; | ||
then | ||
PRE_COMMIT_EXISTS=1 | ||
else | ||
PRE_COMMIT_EXISTS=0 | ||
fi | ||
|
||
cp ./.github/hooks/pre-commit .git/hooks/pre-commit | ||
chmod +x .git/hooks/pre-commit | ||
|
||
if [ "$PRE_COMMIT_EXISTS" = 0 ]; | ||
then | ||
echo "Pre-commit git hook is installed!" | ||
else | ||
echo "Pre-commit git hook is updated!" | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0"?> | ||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
name="PHPCS ruleset" | ||
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd" | ||
> | ||
<description>Test Classes and Tests. Config optimized for local CLO and CI/CD.</description> | ||
|
||
<rule ref="PHPCompatibility"/> | ||
<rule ref="PSR12"/> | ||
|
||
<file>Classes</file> | ||
|
||
<config name="testVersion" value="7.4-"/> | ||
|
||
<arg name="extensions" value="php" /> | ||
<arg name="basepath" value="."/> | ||
<arg name="colors"/> | ||
<arg name="parallel" value="75"/> | ||
<arg value="nps"/> | ||
</ruleset> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="PHPMD 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> | ||
Adapted the phpmd default config. | ||
* Import all rule sets | ||
* Allow variables as long as 25 chars | ||
</description> | ||
|
||
<rule ref="rulesets/codesize.xml" /> | ||
<rule ref="rulesets/controversial.xml" /> | ||
<rule ref="rulesets/design.xml" /> | ||
<rule ref="rulesets/naming.xml"> | ||
<exclude name="LongVariable" /> | ||
</rule> | ||
<rule ref="rulesets/naming.xml/LongVariable"> | ||
<properties> | ||
<property name="maximum" value="26" /> | ||
</properties> | ||
</rule> | ||
<rule ref="rulesets/unusedcode.xml" /> | ||
<rule ref="rulesets/cleancode.xml"> | ||
<exclude name="StaticAccess" /> | ||
<exclude name="ElseExpression" /> | ||
<exclude name="StaticAccess"/> | ||
</rule> | ||
</ruleset> |
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
Oops, something went wrong.