TASK: Add further linting

This commit is contained in:
Daniel Siepmann 2017-04-09 00:10:22 +02:00
parent 3e89316430
commit b8d84c5bdc
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
4 changed files with 81 additions and 9 deletions

View file

@ -2,10 +2,33 @@ before_script:
- apk add --no-cache make wget git - apk add --no-cache make wget git
- make install-composer - make install-composer
- make install - make install
- mkdir -p result
stages: stages:
- test - test
lint:coding-guideline:
image: php:7.0-alpine
stage: test
script:
- ./vendor/bin/phpcs -s
- ./vendor/bin/phpcs -s > result/phpcs-summary.txt
artifacts:
when: on_failure
paths:
- result
lint:php-mass-detection:
image: php:7.0-alpine
stage: test
script:
- ./vendor/bin/phpmd src text phpmd.xml > result/phpmd.txt
- ./vendor/bin/phpmd src html phpmd.xml > result/phpmd.html
artifacts:
when: on_failure
paths:
- result
test:5.6: test:5.6:
image: php:5.6-alpine image: php:5.6-alpine
stage: test stage: test
@ -18,4 +41,10 @@ test:7.0:
script: script:
- ./vendor/bin/phpunit - ./vendor/bin/phpunit
test:latest:
image: php:7-alpine
stage: test
script:
- ./vendor/bin/phpunit
# Further stages, and jobs e.g. linting, cgl, etc. # Further stages, and jobs e.g. linting, cgl, etc.

View file

@ -2,6 +2,13 @@
"name": "siepmann/typo3_update", "name": "siepmann/typo3_update",
"description": "Auto migrate PHP Source of extensions to be compatible.", "description": "Auto migrate PHP Source of extensions to be compatible.",
"type": "project", "type": "project",
"license": "GPL-2.0+",
"authors": [
{
"name": "Daniel Siepmann",
"email": "coding@daniel-siepmann.de"
}
],
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Typo3Update\\Tests\\": "tests/", "Typo3Update\\Tests\\": "tests/",
@ -22,15 +29,10 @@
"squizlabs/php_codesniffer": "2.8.*", "squizlabs/php_codesniffer": "2.8.*",
"symfony/yaml": "3.2.*" "symfony/yaml": "3.2.*"
}, },
"license": "GPL-2.0+",
"authors": [
{
"name": "Daniel Siepmann",
"email": "coding@daniel-siepmann.de"
}
],
"require-dev": { "require-dev": {
"phpunit/phpunit": "^5.7", "phpunit/phpunit": "5.7.*",
"symfony/finder": "^3.2" "symfony/finder": "3.2.*",
"phpmd/phpmd": "2.6.*",
"pdepend/pdepend": "2.5.*"
} }
} }

22
phpcs.xml.dist Normal file
View file

@ -0,0 +1,22 @@
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<description>The coding standard for this Project</description>
<rule ref="PSR2"/>
<file>./src</file>
<file>./tests</file>
<exclude-pattern>*/Fixtures/*</exclude-pattern>
<!-- Excludes for PHPCS Code Style -->
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<exclude-pattern>*Sniff.php$</exclude-pattern>
<exclude-pattern>*/Tokenizers/*</exclude-pattern>
</rule>
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
<exclude-pattern>*Sniff.php$</exclude-pattern>
<exclude-pattern>*/Tokenizers/*</exclude-pattern>
</rule>
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
<exclude-pattern>*Sniff.php$</exclude-pattern>
<exclude-pattern>*/Tokenizers/*</exclude-pattern>
</rule>
</ruleset>

19
phpmd.xml Normal file
View file

@ -0,0 +1,19 @@
<?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>
My custom rule set that checks my code...
</description>
<rule ref="rulesets/cleancode.xml" />
<rule ref="rulesets/codesize.xml" />
<rule ref="rulesets/controversial.xml" />
<rule ref="rulesets/design.xml" />
<rule ref="rulesets/naming.xml" />
<rule ref="rulesets/unusedcode.xml" />
</ruleset>