Skip to content

Commit 14e6167

Browse files
authored
Merge pull request #837 from wmde/mediawiki-codesniffer
Replace wikibase-codesniffer with mediawiki-codesniffer
2 parents 1930078 + b33833d commit 14e6167

3 files changed

Lines changed: 35 additions & 8 deletions

File tree

.phpcs.xml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,39 @@
11
<?xml version="1.0"?>
22
<ruleset>
3-
<rule ref="./vendor/wikibase/wikibase-codesniffer/Wikibase" />
43

5-
<rule ref="Generic.Files.LineLength">
6-
<properties>
7-
<property name="lineLimit" value="120" />
8-
</properties>
4+
<!-- This rule set includes all rules from the MediaWiki rule set, see
5+
https://github.com/wikimedia/mediawiki-tools-codesniffer/blob/master/MediaWiki/ruleset.xml
6+
-->
7+
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
8+
9+
<!-- The function comment sniff is way to rigorous about way to many details that need
10+
exceptions:
11+
* It complains about missing documentation on fully self-explanatory function headers
12+
with strict type hints.
13+
* It complains about missing documentation if there is a proper @see tag.
14+
* It complains about duplicate spaces in "@param <type> $<var>", but removing these
15+
doesn't make the code easier to read.
16+
* It does not understand "@param <type> [$optional,…]. -->
17+
<exclude name="MediaWiki.Commenting.FunctionComment" />
18+
19+
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
20+
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
21+
22+
<!-- We disagree with the idea of certain characters making comments "illegal" and blocking
23+
patches from being merged. This behaves especially bad on code examples. -->
24+
<exclude name="MediaWiki.Commenting.IllegalSingleLineComment" />
25+
26+
<!-- Starting a function's body with an empty line can be helpful after a very large header.
27+
The code is not guaranteed to be easier to read if this is disallowed. -->
28+
<exclude name="MediaWiki.WhiteSpace.DisallowEmptyLineFunctions" />
29+
30+
<!-- Even if we encourage to use a space in "function ()", we don't think this sniff should
31+
block patches from being merged. -->
32+
<exclude name="MediaWiki.WhiteSpace.SpaceAfterClosure" />
33+
34+
<!-- Even if we encourage to use spaces in comments, we don't think this sniff should block
35+
patches from being merged. -->
36+
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment" />
937
</rule>
1038

1139
<!-- Metrics are intentionally not part of the base Wikibase CodeSniffer rule set. -->

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"ockcyp/covers-validator": "~1.1",
3636
"phpmd/phpmd": "~2.6",
3737
"phpunit/phpunit": "~8.0",
38-
"wikibase/wikibase-codesniffer": "~1.2.0"
38+
"mediawiki/mediawiki-codesniffer": "33.0.0"
3939
},
4040
"autoload": {
4141
"psr-4": {

src/Statement/Statement.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use InvalidArgumentException;
77
use Wikibase\DataModel\Entity\PropertyId;
88
use Wikibase\DataModel\PropertyIdProvider;
9-
use Wikibase\DataModel\Reference;
109
use Wikibase\DataModel\ReferenceList;
1110
use Wikibase\DataModel\Snak\Snak;
1211
use Wikibase\DataModel\Snak\SnakList;
@@ -55,7 +54,7 @@ class Statement implements Comparable, PropertyIdProvider {
5554
private $references;
5655

5756
/**
58-
* @var integer, element of the Statement::RANK_ enum
57+
* @var int element of the Statement::RANK_ enum
5958
*/
6059
private $rank = self::RANK_NORMAL;
6160

0 commit comments

Comments
 (0)