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

Commit 9e2a475

Browse files
committed
Update PHPCS config, run PHPCS checks as a part of the CI build
1 parent ee9a174 commit 9e2a475

File tree

4 files changed

+12
-38
lines changed

4 files changed

+12
-38
lines changed

DataTypes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
namespace DataTypes;
1111

12-
if ( defined( 'DataTypes_VERSION' ) ) {
12+
if ( defined( 'DATATYPES_VERSION' ) ) {
1313
// Do not initialize more than once.
1414
return 1;
1515
}
1616

17-
define( 'DataTypes_VERSION', '1.0.0' );
17+
define( 'DATATYPES_VERSION', '1.0.0' );
1818

1919
if ( defined( 'MEDIAWIKI' ) ) {
2020
include __DIR__ . '/DataTypes.mw.php';

build/travis/script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ cd -
1010

1111
fi
1212

13-
composer test
13+
composer ci
1414
./node_modules/.bin/eslint .

composer.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"php": ">=5.5.0"
2727
},
2828
"require-dev": {
29-
"mediawiki/mediawiki-codesniffer": "~0.7",
30-
"phpunit/phpunit": "~4.8"
29+
"phpunit/phpunit": "~4.8",
30+
"wikibase/wikibase-codesniffer": "^0.1.0"
3131
},
3232
"autoload": {
3333
"files" : [
@@ -42,7 +42,11 @@
4242
"phpunit"
4343
],
4444
"phpcs": [
45-
"vendor/bin/phpcs src/* tests/* --standard=phpcs.xml -sp"
45+
"vendor/bin/phpcs -sp"
46+
],
47+
"ci": [
48+
"@test",
49+
"@phpcs"
4650
]
4751
}
4852
}

phpcs.xml

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,6 @@
11
<?xml version="1.0"?>
22
<ruleset name="DataValuesDataTypes">
3-
<!-- See https://github.com/wikimedia/mediawiki-tools-codesniffer/blob/master/MediaWiki/ruleset.xml -->
4-
<rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
3+
<rule ref="vendor/wikibase/wikibase-codesniffer/Wikibase" />
54

6-
<rule ref="Generic.ControlStructures" />
7-
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag" />
8-
9-
<rule ref="PSR1" />
10-
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
11-
<!-- Exclude test methods like "testGivenInvalidInput_methodThrowsException". -->
12-
<exclude-pattern>tests*Test*\.php</exclude-pattern>
13-
</rule>
14-
15-
<rule ref="PSR2.Files" />
16-
17-
<rule ref="Squiz.Classes.DuplicateProperty" />
18-
<rule ref="Squiz.Classes.SelfMemberReference" />
19-
<rule ref="Squiz.ControlStructures.ControlSignature" />
20-
<rule ref="Squiz.Functions.FunctionDuplicateArgument" />
21-
<rule ref="Squiz.Functions.GlobalFunction" />
22-
<rule ref="Squiz.Scope" />
23-
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
24-
<properties>
25-
<property name="spacing" value="1" />
26-
</properties>
27-
</rule>
28-
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
29-
<properties>
30-
<property name="ignoreNewlines" value="true" />
31-
</properties>
32-
</rule>
33-
34-
<arg name="extensions" value="php" />
35-
<arg name="encoding" value="utf8" />
5+
<file>.</file>
366
</ruleset>

0 commit comments

Comments
 (0)