Skip to content

Commit

Permalink
Add PHP_CodeSniffer
Browse files Browse the repository at this point in the history
  • Loading branch information
PhrozenByte committed Nov 27, 2015
1 parent 54305c4 commit 31acaff
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -20,7 +20,7 @@ before_script:
- export PATH="$TRAVIS_BUILD_DIR/build:$TRAVIS_BUILD_DIR/vendor/bin:$PATH" - export PATH="$TRAVIS_BUILD_DIR/build:$TRAVIS_BUILD_DIR/vendor/bin:$PATH"


script: script:
- find . -not \( -path './vendor' -prune \) -type f -name '*.php' -print0 | xargs -0 -I file php -l file > /dev/null - phpcs --standard=phpcs.xml "$TRAVIS_BUILD_DIR"


after_success: after_success:
- deploy-phpdoc-branch.sh - deploy-phpdoc-branch.sh
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -29,7 +29,8 @@
"symfony/yaml" : "^2.3" "symfony/yaml" : "^2.3"
}, },
"require-dev" : { "require-dev" : {
"phpdocumentor/phpdocumentor": "^2.8" "phpdocumentor/phpdocumentor": "^2.8",
"squizlabs/php_codesniffer": "^2.4"
}, },
"autoload": { "autoload": {
"psr-0": { "psr-0": {
Expand Down
4 changes: 3 additions & 1 deletion index.php
@@ -1,4 +1,6 @@
<?php <?php
// @codingStandardsIgnoreFile

// load dependencies // load dependencies
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');


Expand All @@ -11,7 +13,7 @@
); );


// override configuration? // override configuration?
// $pico->setConfig(array()); //$pico->setConfig(array());


// run application // run application
echo $pico->run(); echo $pico->run();
39 changes: 39 additions & 0 deletions phpcs.xml
@@ -0,0 +1,39 @@
<?xml version="1.0"?>
<ruleset name="Pico">
<description>
Pico's coding standards mainly base on the PHP-FIG PSR-2 standard,
but without the MissingNamespace sniff.
</description>

<!--
Exclude build/ and vendor/ dirs as well as minified JavaScript files
-->
<exclude-pattern type="relative">^build/</exclude-pattern>
<exclude-pattern type="relative">^vendor/</exclude-pattern>
<exclude-pattern>*.min.js</exclude-pattern>

<!--
Check files for PHP syntax errors
-->
<config name="php_path" value="php"/>
<rule ref="Generic.PHP.Syntax"/>

<!--
Never use deprecated functions,
as they will be removed in future PHP releases
-->
<rule ref="Generic.PHP.DeprecatedFunctions"/>

<!--
Warn about structures which affect performance negatively
-->
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>

<!--
Pico follows PHP-FIG PSR-2 Coding Style,
but doesn't use formal namespaces for historic reasons
-->
<rule ref="PSR2">
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
</rule>
</ruleset>

0 comments on commit 31acaff

Please sign in to comment.