From e74744c6202ab48c62ad10e2a5c584adf20a2c8d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 23 Nov 2013 20:29:27 +0100 Subject: [PATCH 1/6] Add CodeSniffer as composer development dependency. --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 79c92b52..e67550c3 100644 --- a/composer.json +++ b/composer.json @@ -31,6 +31,9 @@ "require": { "php": ">=5.0.0" }, + "require-dev": { + "squizlabs/php_codesniffer": "1.*" + }, "suggest": { "ext-mcrypt": "Install the Mcrypt extension in order to speed up a wide variety of cryptographic operations.", "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", From 6ed4e3c92ec21d6b01e098794026405b03835c27 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 23 Nov 2013 20:31:06 +0100 Subject: [PATCH 2/6] Add composer.lock file. --- composer.lock | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 composer.lock diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..2bdf3602 --- /dev/null +++ b/composer.lock @@ -0,0 +1,96 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + ], + "hash": "e692359d277b10176319a11c2aef51aa", + "packages": [ + + ], + "packages-dev": [ + { + "name": "squizlabs/php_codesniffer", + "version": "1.4.7", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "df764a1604607ea61c4eeea5410666e27cb37a8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/df764a1604607ea61c4eeea5410666e27cb37a8b", + "reference": "df764a1604607ea61c4eeea5410666e27cb37a8b", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.1.2" + }, + "suggest": { + "phpunit/php-timer": "dev-master" + }, + "bin": [ + "scripts/phpcs" + ], + "type": "library", + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/MultiFileSniff.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/CommentParser/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2013-09-26 00:08:21" + } + ], + "aliases": [ + + ], + "minimum-stability": "stable", + "stability-flags": [ + + ], + "platform": { + "php": ">=5.0.0" + }, + "platform-dev": [ + + ] +} From f0dcc74c29314191aa1c4031695374f63855d591 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 23 Nov 2013 20:38:11 +0100 Subject: [PATCH 3/6] Install composer dependencies on Travis CI. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6a319dd6..8c524332 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ env: before_script: - git clone git://github.com/zenovich/runkit.git && cd runkit && phpize && ./configure && make && make install && cd .. - echo "extension=runkit.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` + - composer install --dev --no-interaction script: - phpunit --verbose --coverage-text --coverage-html code_coverage/ From dc0fc84bd00223f1a0bfae46751f4d9b4a276047 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 23 Nov 2013 21:01:26 +0100 Subject: [PATCH 4/6] Add ruleset for phpseclib coding standard. --- tests/code_sniffer_ruleset.xml | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/code_sniffer_ruleset.xml diff --git a/tests/code_sniffer_ruleset.xml b/tests/code_sniffer_ruleset.xml new file mode 100644 index 00000000..e321c7d4 --- /dev/null +++ b/tests/code_sniffer_ruleset.xml @@ -0,0 +1,45 @@ + + + + phpseclib coding standard + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From e6be743fe2ab5b91b6817899257a3781f33ab06a Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 23 Nov 2013 21:02:23 +0100 Subject: [PATCH 5/6] Run code sniffer on PHP 5.5 environment on Travis CI. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 8c524332..8110adc8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ before_script: - composer install --dev --no-interaction script: + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' ]; then vendor/bin/phpcs -s --extensions=php --standard=tests/code_sniffer_ruleset.xml phpseclib/; fi" - phpunit --verbose --coverage-text --coverage-html code_coverage/ after_success: From 552459d55e74996bd2d1b7330135447f88bb24e9 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 23 Nov 2013 21:08:37 +0100 Subject: [PATCH 6/6] Only install composer dependencies in PHP 5.5 environment. There is currently no point in installing in any other environment. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8110adc8..d028aa13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ env: before_script: - git clone git://github.com/zenovich/runkit.git && cd runkit && phpize && ./configure && make && make install && cd .. - echo "extension=runkit.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` - - composer install --dev --no-interaction + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' ]; then composer install --dev --no-interaction; fi" script: - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' ]; then vendor/bin/phpcs -s --extensions=php --standard=tests/code_sniffer_ruleset.xml phpseclib/; fi"