mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Lint php coding standards via CI
This commit is contained in:
parent
c7214b4dcd
commit
a80b8aef60
@ -6,7 +6,7 @@
|
|||||||
charset = utf-8
|
charset = utf-8
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
indent_style = tab
|
indent_style = space
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -1,6 +1,7 @@
|
|||||||
docs/ export-ignore
|
docs/ export-ignore
|
||||||
javascript/src/ export ignore
|
javascript/src/ export-ignore
|
||||||
behat.yml export ignore
|
behat.yml export-ignore
|
||||||
|
*.dist export-ignore
|
||||||
|
|
||||||
# Hide diffs
|
# Hide diffs
|
||||||
javascript/dist/ -diff
|
javascript/dist/ -diff
|
||||||
|
@ -24,7 +24,7 @@ matrix:
|
|||||||
- php: 5.5
|
- php: 5.5
|
||||||
env: DB=SQLITE PHPUNIT_TEST=1
|
env: DB=SQLITE PHPUNIT_TEST=1
|
||||||
- php: 5.6
|
- php: 5.6
|
||||||
env: DB=MYSQL PDO=1 PHPUNIT_TEST=1
|
env: DB=MYSQL PDO=1 PHPUNIT_TEST=1 PHPCS_TEST=1
|
||||||
- php: 5.6
|
- php: 5.6
|
||||||
env: DB=MYSQL BEHAT_TEST=1
|
env: DB=MYSQL BEHAT_TEST=1
|
||||||
- php: 5.6
|
- php: 5.6
|
||||||
@ -36,6 +36,7 @@ matrix:
|
|||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- composer self-update || true
|
- composer self-update || true
|
||||||
|
- "if [ \"$PHPCS_TEST\" = \"1\" ]; then pyrus install pear/PHP_CodeSniffer; fi"
|
||||||
- phpenv rehash
|
- phpenv rehash
|
||||||
- phpenv config-rm xdebug.ini
|
- phpenv config-rm xdebug.ini
|
||||||
- echo 'memory_limit = 2G' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
|
- echo 'memory_limit = 2G' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
|
||||||
@ -59,6 +60,7 @@ script:
|
|||||||
- "if [ \"$NPM_TEST\" = \"1\" ]; then (nvm use $TRAVIS_NODE_VERSION && npm run lint); fi"
|
- "if [ \"$NPM_TEST\" = \"1\" ]; then (nvm use $TRAVIS_NODE_VERSION && npm run lint); fi"
|
||||||
- "if [ \"$PHPUNIT_COVERAGE_TEST\" = \"1\" ]; then phpdbg -qrr vendor/bin/phpunit tests flush=1 --coverage-clover=coverage.xml; fi"
|
- "if [ \"$PHPUNIT_COVERAGE_TEST\" = \"1\" ]; then phpdbg -qrr vendor/bin/phpunit tests flush=1 --coverage-clover=coverage.xml; fi"
|
||||||
- "if [ \"$PHPUNIT_COVERAGE_TEST\" = \"1\" ]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi"
|
- "if [ \"$PHPUNIT_COVERAGE_TEST\" = \"1\" ]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi"
|
||||||
|
- "if [ \"$PHPCS_TEST\" = \"1\" ]; then composer run-script lint; fi"
|
||||||
|
|
||||||
after_failure:
|
after_failure:
|
||||||
- php ~/travis-support/travis_upload_artifacts.php --if-env BEHAT_TEST,ARTIFACTS_KEY --target-path $TRAVIS_REPO_SLUG/$TRAVIS_BUILD_ID/$TRAVIS_JOB_ID --artifacts-base-url https://s3.amazonaws.com/$ARTIFACTS_BUCKET/
|
- php ~/travis-support/travis_upload_artifacts.php --if-env BEHAT_TEST,ARTIFACTS_KEY --target-path $TRAVIS_REPO_SLUG/$TRAVIS_BUILD_ID/$TRAVIS_JOB_ID --artifacts-base-url https://s3.amazonaws.com/$ARTIFACTS_BUCKET/
|
||||||
|
@ -34,6 +34,9 @@
|
|||||||
"dev-master": "4.0.x-dev"
|
"dev-master": "4.0.x-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "phpcs -s code/ tests/"
|
||||||
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"SilverStripe\\CMS\\": "code/"
|
"SilverStripe\\CMS\\": "code/"
|
||||||
|
18
phpcs.xml.dist
Normal file
18
phpcs.xml.dist
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ruleset name="SilverStripe">
|
||||||
|
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
|
||||||
|
|
||||||
|
<!-- base rules are PSR-2 -->
|
||||||
|
<rule ref="PSR2" >
|
||||||
|
<!-- Current exclusions -->
|
||||||
|
<exclude name="PSR1.Methods.CamelCapsMethodName" />
|
||||||
|
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
|
||||||
|
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
|
||||||
|
<exclude name="Generic.Files.LineLength.TooLong" />
|
||||||
|
|
||||||
|
<!-- CMS specific exclusions (high priority to fix) -->
|
||||||
|
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
|
||||||
|
<exclude name="PSR1.Classes.ClassDeclaration.MultipleClasses" />
|
||||||
|
</rule>
|
||||||
|
</ruleset>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user