Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
Merge pull request #69 from wmde/phpcs
Browse files Browse the repository at this point in the history
Update PHPCS config, run PHPCS checks as a part of the CI build
  • Loading branch information
Ladsgroup committed Jul 31, 2017
2 parents ee9a174 + 9e2a475 commit af8a63e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 38 deletions.
4 changes: 2 additions & 2 deletions DataTypes.php
Expand Up @@ -9,12 +9,12 @@

namespace DataTypes;

if ( defined( 'DataTypes_VERSION' ) ) {
if ( defined( 'DATATYPES_VERSION' ) ) {
// Do not initialize more than once.
return 1;
}

define( 'DataTypes_VERSION', '1.0.0' );
define( 'DATATYPES_VERSION', '1.0.0' );

if ( defined( 'MEDIAWIKI' ) ) {
include __DIR__ . '/DataTypes.mw.php';
Expand Down
2 changes: 1 addition & 1 deletion build/travis/script.sh
Expand Up @@ -10,5 +10,5 @@ cd -

fi

composer test
composer ci
./node_modules/.bin/eslint .
10 changes: 7 additions & 3 deletions composer.json
Expand Up @@ -26,8 +26,8 @@
"php": ">=5.5.0"
},
"require-dev": {
"mediawiki/mediawiki-codesniffer": "~0.7",
"phpunit/phpunit": "~4.8"
"phpunit/phpunit": "~4.8",
"wikibase/wikibase-codesniffer": "^0.1.0"
},
"autoload": {
"files" : [
Expand All @@ -42,7 +42,11 @@
"phpunit"
],
"phpcs": [
"vendor/bin/phpcs src/* tests/* --standard=phpcs.xml -sp"
"vendor/bin/phpcs -sp"
],
"ci": [
"@test",
"@phpcs"
]
}
}
34 changes: 2 additions & 32 deletions phpcs.xml
@@ -1,36 +1,6 @@
<?xml version="1.0"?>
<ruleset name="DataValuesDataTypes">
<!-- See https://github.com/wikimedia/mediawiki-tools-codesniffer/blob/master/MediaWiki/ruleset.xml -->
<rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
<rule ref="vendor/wikibase/wikibase-codesniffer/Wikibase" />

<rule ref="Generic.ControlStructures" />
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag" />

<rule ref="PSR1" />
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<!-- Exclude test methods like "testGivenInvalidInput_methodThrowsException". -->
<exclude-pattern>tests*Test*\.php</exclude-pattern>
</rule>

<rule ref="PSR2.Files" />

<rule ref="Squiz.Classes.DuplicateProperty" />
<rule ref="Squiz.Classes.SelfMemberReference" />
<rule ref="Squiz.ControlStructures.ControlSignature" />
<rule ref="Squiz.Functions.FunctionDuplicateArgument" />
<rule ref="Squiz.Functions.GlobalFunction" />
<rule ref="Squiz.Scope" />
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
<properties>
<property name="spacing" value="1" />
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true" />
</properties>
</rule>

<arg name="extensions" value="php" />
<arg name="encoding" value="utf8" />
<file>.</file>
</ruleset>

0 comments on commit af8a63e

Please sign in to comment.