Enable PHPCS and lint checks via `composer test`

Sniffs that are currently failing are disabled in phpcs.xml.

Additional changes:
* Fix problem in test file

Change-Id: I53642e9d7bc1ef96e359cfe04a8f93dabbc977eb
This commit is contained in:
Piotr Miazga 2017-07-17 21:49:49 +02:00 committed by Jdlrobson
parent d5461f55a1
commit 7536ca089a
3 changed files with 45 additions and 1 deletions

16
composer.json Normal file
View File

@ -0,0 +1,16 @@
{
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
"mediawiki/mediawiki-codesniffer": "0.10.0",
"jakub-onderka/php-console-highlighter": "0.3.2"
},
"scripts": {
"test": [
"parallel-lint . --exclude vendor",
"phpcs -p -s"
],
"fix": [
"phpcbf"
]
}
}

28
phpcs.xml Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName"/>
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment"/>
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage"/>
<exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag"/>
<exclude name="MediaWiki.Commenting.FunctionComment.MissingParamComment"/>
<exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle"/>
<exclude name="MediaWiki.Commenting.FunctionComment.ParamNameNoMatch"/>
<exclude name="MediaWiki.Commenting.FunctionComment.SpacingAfterParamType"/>
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected"/>
<exclude name="MediaWiki.Commenting.FunctionComment.MissingReturn"/>
</rule>
<file>.</file>
<arg name="extensions" value="php,php5,inc"/>
<arg name="encoding" value="UTF-8"/>
<exclude-pattern>vendor</exclude-pattern>
<exclude-pattern>node_modules</exclude-pattern>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1" />
<property name="requiredSpacesAfterOpen" value="1"/>
<property name="requiredSpacesBeforeClose" value="1" />
</properties>
</rule>
</ruleset>

View File

@ -175,7 +175,7 @@ class SkinMinervaTest extends MediaWikiTestCase {
$testContext = RequestContext::getMain();
$testContext->setTitle( $title );
$skin->setContext ( $testContext );
$skin->setContext( $testContext );
$skin->setSkinOptions( [
'fontChanger' => $fontchangerValue,
'backToTop' => $backToTopValue,