Skip to content

Commit

Permalink
Merge pull request #243 from wmde/mediawiki-codesniffer
Browse files Browse the repository at this point in the history
Replace wikibase-codesniffer with mediawiki-codesniffer
  • Loading branch information
rosalieper committed Jan 7, 2021
2 parents a0c10e1 + 4113b34 commit e217f37
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
35 changes: 34 additions & 1 deletion .phpcs.xml
@@ -1,6 +1,39 @@
<?xml version="1.0"?>
<ruleset>
<rule ref="vendor/wikibase/wikibase-codesniffer/Wikibase" />
<!-- This rule set includes all rules from the MediaWiki rule set, see
https://github.com/wikimedia/mediawiki-tools-codesniffer/blob/master/MediaWiki/ruleset.xml
-->
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">

<!-- The function comment sniff is way to rigorous about way to many details that need
exceptions:
* It complains about missing documentation on fully self-explanatory function headers
with strict type hints.
* It complains about missing documentation if there is a proper @see tag.
* It complains about duplicate spaces in "@param <type> $<var>", but removing these
doesn't make the code easier to read.
* It does not understand "@param <type> [$optional,…]. -->
<exclude name="MediaWiki.Commenting.FunctionComment" />

<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />

<!-- We disagree with the idea of certain characters making comments "illegal" and blocking
patches from being merged. This behaves especially bad on code examples. -->
<exclude name="MediaWiki.Commenting.IllegalSingleLineComment" />

<!-- Starting a function's body with an empty line can be helpful after a very large header.
The code is not guaranteed to be easier to read if this is disallowed. -->
<exclude name="MediaWiki.WhiteSpace.DisallowEmptyLineFunctions" />

<!-- Even if we encourage to use a space in "function ()", we don't think this sniff should
block patches from being merged. -->
<exclude name="MediaWiki.WhiteSpace.SpaceAfterClosure" />

<!-- Even if we encourage to use spaces in comments, we don't think this sniff should block
patches from being merged. -->
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment" />
</rule>

<rule ref="Generic.Files.LineLength">
<properties>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -33,7 +33,7 @@
"require-dev": {
"phpmd/phpmd": "~2.3",
"phpunit/phpunit": "~8.0",
"wikibase/wikibase-codesniffer": "~1.2.0"
"mediawiki/mediawiki-codesniffer": "33.0.0"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit e217f37

Please sign in to comment.