-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PHP Codesniffer. Update PHPUnit to support 7.4 (#36)
* Add PHP Codesniffer. Update PHPUnit to support 7.4 * Update to Silverstripe's coding convensions * Fix linting based on Silverstripe standards * Update build status image in README * Update module requirements in README
- Loading branch information
1 parent
91af156
commit 7b0764e
Showing
10 changed files
with
274 additions
and
237 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,23 @@ | ||
language: php | ||
version: ~> 1.0 | ||
|
||
dist: trusty | ||
import: | ||
- silverstripe/silverstripe-travis-shared:config/provision/standard.yml | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache/files | ||
|
||
env: | ||
global: | ||
- COMPOSER_ROOT_VERSION=1.0.x-dev | ||
|
||
matrix: | ||
fast_finish: true | ||
jobs: | ||
include: | ||
- php: 7.1 | ||
env: DB=MYSQL PHPUNIT_TEST=1 | ||
env: | ||
- DB=MYSQL | ||
- REQUIRE_INSTALLER="4.x-dev" | ||
- PHPUNIT_COVERAGE_TEST=1 | ||
- PHPCS_TEST=1 | ||
- php: 7.3 | ||
env: DB=MYSQL PHPUNIT_TEST=1 | ||
|
||
before_script: | ||
# Init PHP | ||
- export CORE_RELEASE=$TRAVIS_BRANCH | ||
- phpenv rehash | ||
- phpenv config-rm xdebug.ini | ||
- export PATH=~/.composer/vendor/bin:$PATH | ||
- echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini | ||
|
||
# Install composer | ||
- composer validate | ||
- composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile | ||
|
||
script: | ||
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/php; fi | ||
env: | ||
- DB=MYSQL | ||
- REQUIRE_INSTALLER="4.x-dev" | ||
- PHPUNIT_COVERAGE_TEST=1 | ||
- php: 7.4 | ||
env: | ||
- DB=MYSQL | ||
- REQUIRE_INSTALLER="4.x-dev" | ||
- PHPUNIT_COVERAGE_TEST=1 |
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
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
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,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ruleset name="SilverStripe"> | ||
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description> | ||
|
||
<file>code</file> | ||
<file>tests</file> | ||
|
||
<!-- base rules are PSR-2 --> | ||
<rule ref="PSR2" > | ||
<!-- Current exclusions --> | ||
<exclude name="PSR1.Methods.CamelCapsMethodName" /> | ||
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" /> | ||
<exclude name="PSR2.Classes.PropertyDeclaration" /> | ||
<exclude name="PSR2.ControlStructures.SwitchDeclaration" /> <!-- causes php notice while linting --> | ||
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenercase" /> | ||
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenerdefault" /> | ||
<exclude name="PSR2.ControlStructures.SwitchDeclaration.TerminatingComment" /> | ||
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" /> | ||
<exclude name="Squiz.Scope.MethodScope" /> | ||
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" /> | ||
<exclude name="Generic.Files.LineLength.TooLong" /> | ||
<exclude name="PEAR.Functions.ValidDefaultValue.NotAtEnd" /> | ||
</rule> | ||
|
||
<rule ref="Squiz.Strings.ConcatenationSpacing"> | ||
<properties> | ||
<property name="spacing" value="1" /> | ||
<property name="ignoreNewlines" value="true"/> | ||
</properties> | ||
</rule> | ||
|
||
<!-- use short array syntax (less thirdparty) --> | ||
<rule ref="Generic.Arrays.DisallowLongArraySyntax"> | ||
<exclude-pattern>/thirdparty/*</exclude-pattern> | ||
</rule> | ||
|
||
<!-- include php files only --> | ||
<arg name="extensions" value="php,lib,inc,php5"/> | ||
</ruleset> |
Oops, something went wrong.