2015-06-29 21:35:38 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
<ruleset name="MediaWiki">
|
2017-06-05 16:05:55 +00:00
|
|
|
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
2019-12-08 23:52:32 +00:00
|
|
|
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
|
2017-08-11 21:45:25 +00:00
|
|
|
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
|
|
|
|
|
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
|
2021-01-30 12:51:38 +00:00
|
|
|
<exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle" />
|
2020-10-28 18:58:11 +00:00
|
|
|
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
|
|
|
|
|
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
|
|
|
|
|
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />
|
|
|
|
|
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingVar" />
|
|
|
|
|
<exclude name="MediaWiki.Commenting.PropertyDocumentation.SpacingAfter" />
|
|
|
|
|
<exclude name="MediaWiki.Commenting.PropertyDocumentation.WrongStyle" />
|
2017-05-04 19:35:41 +00:00
|
|
|
<exclude name="MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures" />
|
|
|
|
|
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
|
|
|
|
|
<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
|
2019-02-07 09:21:19 +00:00
|
|
|
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgTitle" />
|
2020-05-30 10:36:42 +00:00
|
|
|
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgVersion" />
|
2020-10-28 18:58:11 +00:00
|
|
|
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage" />
|
2018-07-26 16:31:49 +00:00
|
|
|
<exclude name="MediaWiki.Usage.ForbiddenFunctions.passthru" />
|
2021-01-30 12:51:38 +00:00
|
|
|
<exclude name="MediaWiki.Usage.SuperGlobalsUsage.SuperGlobals" />
|
2018-07-26 16:31:49 +00:00
|
|
|
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
|
2021-01-30 12:51:38 +00:00
|
|
|
<exclude name="PSR2.Classes.PropertyDeclaration.Multiple" />
|
2020-05-19 21:49:33 +00:00
|
|
|
</rule>
|
2015-09-09 21:12:15 +00:00
|
|
|
<rule ref="MediaWiki.NamingConventions.PrefixedGlobalFunctions">
|
|
|
|
|
<properties>
|
2017-10-11 18:25:26 +00:00
|
|
|
<!--
|
|
|
|
|
maintenance/language/transstat.php
|
|
|
|
|
* showUsage
|
|
|
|
|
maintenance/mcc.php
|
|
|
|
|
* mccGetHelp
|
|
|
|
|
* mccShowUsage
|
|
|
|
|
maintenance/storage/moveToExternal.php
|
|
|
|
|
* moveToExternal
|
|
|
|
|
maintenance/storage/resolveStubs.php
|
|
|
|
|
* resolveStub
|
|
|
|
|
* resolveStubs
|
|
|
|
|
tests/phpunit/includes/HooksTest.php
|
|
|
|
|
* NothingFunction
|
|
|
|
|
* NothingFunctionData
|
|
|
|
|
tests/qunit/data/styleTest.css.php
|
|
|
|
|
* cssfilter
|
|
|
|
|
-->
|
2021-09-19 11:47:08 +00:00
|
|
|
<property name="ignoreList" type="array" value="cssfilter,mccGetHelp,mccShowUsage,moveToExternal,NothingFunction,NothingFunctionData,resolveStub,resolveStubs,showUsage" />
|
2015-09-09 21:12:15 +00:00
|
|
|
</properties>
|
|
|
|
|
</rule>
|
2015-09-10 05:29:32 +00:00
|
|
|
<rule ref="MediaWiki.NamingConventions.ValidGlobalName">
|
|
|
|
|
<properties>
|
2020-03-18 17:43:23 +00:00
|
|
|
<property name="ignoreList" type="array" value="$IP" />
|
2015-09-10 05:29:32 +00:00
|
|
|
</properties>
|
|
|
|
|
</rule>
|
2018-07-26 16:31:49 +00:00
|
|
|
<rule ref="MediaWiki.NamingConventions.ValidGlobalName.allowedPrefix">
|
2021-04-20 22:08:18 +00:00
|
|
|
<exclude-pattern>*/maintenance/doMaintenance\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/mergeMessageFileList\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/CommandLineInc\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/tests/phpunit/MediaWikiIntegrationTestCase\.php</exclude-pattern>
|
2018-07-26 16:31:49 +00:00
|
|
|
</rule>
|
2020-12-23 02:24:31 +00:00
|
|
|
<rule ref="Generic.Classes.DuplicateClassName.Found">
|
2021-04-29 20:00:08 +00:00
|
|
|
<exclude-pattern>*/includes/libs/rdbms/dbal/MWPostgreSqlPlatformCompat\.php</exclude-pattern>
|
2020-12-23 02:24:31 +00:00
|
|
|
</rule>
|
2015-08-25 20:27:41 +00:00
|
|
|
<rule ref="Generic.Files.LineLength">
|
2021-04-20 22:08:18 +00:00
|
|
|
<exclude-pattern>*/languages/messages/*</exclude-pattern>
|
2022-02-16 17:43:43 +00:00
|
|
|
<exclude-pattern>*/tests/*</exclude-pattern>
|
2015-08-25 20:27:41 +00:00
|
|
|
</rule>
|
2018-05-24 02:23:49 +00:00
|
|
|
<rule ref="MediaWiki.Files.ClassMatchesFilename.NotMatch">
|
|
|
|
|
<!--
|
2021-04-18 15:22:58 +00:00
|
|
|
Continue to allow existing violations, but enable the sniff to prevent
|
2018-05-24 02:23:49 +00:00
|
|
|
any new occurrences.
|
|
|
|
|
-->
|
|
|
|
|
<exclude-pattern>*/includes/specials/SpecialMostimages\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/includes/specials/SpecialMovepage\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/includes/specials/SpecialUserrights\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/includes/specials/SpecialWantedfiles\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/includes/specials/SpecialWantedpages\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/benchmarks/bench_HTTP_HTTPS\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/benchmarks/bench_Wikimedia_base_convert\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/benchmarks/bench_delete_truncate\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/benchmarks/bench_if_switch\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/benchmarks/bench_utf8_title_check\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/cleanupTitles\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/edit\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/findDeprecated\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/getText\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/importDump\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/install\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/jsparse\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/lag\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/language/StatOutputs\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/language/date-formats\.php</exclude-pattern>
|
2018-05-20 14:50:41 +00:00
|
|
|
<exclude-pattern>*/maintenance/mysql\.php</exclude-pattern>
|
2018-05-24 02:23:49 +00:00
|
|
|
<exclude-pattern>*/maintenance/parse\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/preprocessorFuzzTest\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/rebuildImages\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/renderDump\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/shell\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/sql\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/update\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/userOptions\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/view\.php</exclude-pattern>
|
|
|
|
|
<!-- Language converters use the pattern of 2 classes in one file -->
|
2021-04-20 22:08:18 +00:00
|
|
|
<exclude-pattern>*/languages/*</exclude-pattern>
|
2019-01-30 05:47:05 +00:00
|
|
|
<!-- Skip violations in some tests for now -->
|
2021-04-20 22:08:18 +00:00
|
|
|
<exclude-pattern>*/tests/parser/*</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/tests/phpunit/maintenance/*</exclude-pattern>
|
2019-01-30 05:47:05 +00:00
|
|
|
<exclude-pattern>*/tests/phpunit/bootstrap\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/tests/phpunit/phpunit\.php</exclude-pattern>
|
2018-05-24 02:23:49 +00:00
|
|
|
</rule>
|
|
|
|
|
<rule ref="MediaWiki.Files.ClassMatchesFilename.WrongCase">
|
|
|
|
|
<!--
|
2021-04-18 15:22:58 +00:00
|
|
|
Continue to allow existing violations, but enable the sniff to prevent
|
2018-05-24 02:23:49 +00:00
|
|
|
any new occurrences.
|
|
|
|
|
-->
|
|
|
|
|
<exclude-pattern>*/maintenance/language/alltrans\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/language/digit2html\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/language/langmemusage\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/mctest\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/mergeMessageFileList\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/mwdocgen\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/rebuildall\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/rebuildmessages\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/rebuildrecentchanges\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/rebuildtextindex\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/storage/checkStorage\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/storage/recompressTracked\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/storage/trackBlobs\.php</exclude-pattern>
|
2019-01-30 05:47:05 +00:00
|
|
|
<!-- Skip violations in some tests for now -->
|
2021-04-20 22:08:18 +00:00
|
|
|
<exclude-pattern>*/tests/phpunit/unit/includes/GlobalFunctions/*</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/tests/phpunit/includes/GlobalFunctions/*</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/tests/phpunit/maintenance/*</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/tests/phpunit/integration/includes/GlobalFunctions/*</exclude-pattern>
|
2018-05-24 02:23:49 +00:00
|
|
|
</rule>
|
2020-05-09 01:15:03 +00:00
|
|
|
<rule ref="Generic.PHP.NoSilencedErrors.Discouraged">
|
|
|
|
|
<!--
|
|
|
|
|
Our normal policy of using Wikimedia\AtEase does not always make sense tests.
|
|
|
|
|
|
|
|
|
|
AtEase cannot be cleanly used in tests that also use expectException() as
|
|
|
|
|
the restoreWarnings() call would never be reached:
|
|
|
|
|
|
|
|
|
|
$this->expectException( PasswordError::class );
|
|
|
|
|
AtEase::suppressWarnings();
|
|
|
|
|
$password->crypt( 'whatever' );
|
|
|
|
|
AtEase::restoreWarnings();
|
|
|
|
|
|
|
|
|
|
The above will stop at crypt(), as expected, and leave AtEase in a dirty
|
|
|
|
|
state for unrelated tests.
|
2018-05-24 02:23:49 +00:00
|
|
|
|
2020-05-09 01:15:03 +00:00
|
|
|
TODO: Stop using PHPUnit TestCase directly. Require with a structure test
|
|
|
|
|
or with a high-level check in our run() hook, that all test cases use either
|
|
|
|
|
MediaWikiUnitTestCase or MediaWikiIntegrationTestCase. Otherwise the check
|
|
|
|
|
in MediaWikiTestCaseTrait can still be bypassed and cause a random failures.
|
|
|
|
|
|
|
|
|
|
-->
|
2021-04-20 22:08:18 +00:00
|
|
|
<exclude-pattern>*/tests/*</exclude-pattern>
|
2020-05-09 01:15:03 +00:00
|
|
|
</rule>
|
2018-05-07 08:53:28 +00:00
|
|
|
<rule ref="Generic.Files.OneObjectStructurePerFile.MultipleFound">
|
|
|
|
|
<!--
|
2021-04-18 15:22:58 +00:00
|
|
|
Continue to allow existing violations, but enable the sniff to prevent
|
2018-05-07 08:53:28 +00:00
|
|
|
any new occurrences.
|
|
|
|
|
-->
|
2021-04-29 20:00:08 +00:00
|
|
|
<exclude-pattern>*/includes/libs/rdbms/dbal/MWPostgreSqlPlatformCompat\.php</exclude-pattern>
|
2018-05-07 08:53:28 +00:00
|
|
|
<exclude-pattern>*/maintenance/dumpIterator\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/findDeprecated\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/storage/recompressTracked\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/preprocessorFuzzTest\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/language/StatOutputs\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/language/generateCollationData\.php</exclude-pattern>
|
|
|
|
|
<!-- Language converters use the pattern of 2 classes in one file -->
|
2021-04-20 22:08:18 +00:00
|
|
|
<exclude-pattern>*/languages/*</exclude-pattern>
|
2018-05-07 08:53:28 +00:00
|
|
|
<!-- We don't care that much about violations in tests -->
|
2021-04-20 22:08:18 +00:00
|
|
|
<exclude-pattern>*/tests/*</exclude-pattern>
|
2018-05-07 08:53:28 +00:00
|
|
|
</rule>
|
2015-10-03 18:52:31 +00:00
|
|
|
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
|
2018-03-29 19:53:10 +00:00
|
|
|
<exclude-pattern>*/includes/StubObject\.php</exclude-pattern>
|
2021-09-04 19:19:47 +00:00
|
|
|
<exclude-pattern>*/includes/StubGlobalUser\.php</exclude-pattern>
|
2019-04-14 10:15:06 +00:00
|
|
|
<exclude-pattern>*/includes/StubUserLang\.php</exclude-pattern>
|
2015-10-03 18:52:31 +00:00
|
|
|
</rule>
|
2018-05-19 21:52:00 +00:00
|
|
|
<rule ref="MediaWiki.Usage.AssignmentInReturn.AssignmentInReturn">
|
2021-04-20 22:08:18 +00:00
|
|
|
<exclude-pattern>*/tests/phpunit/*</exclude-pattern>
|
2018-05-19 21:52:00 +00:00
|
|
|
</rule>
|
2018-06-02 22:38:38 +00:00
|
|
|
<rule ref="MediaWiki.Usage.ForbiddenFunctions.popen">
|
|
|
|
|
<!--
|
2021-04-18 15:22:58 +00:00
|
|
|
Continue to allow existing violations, but enable the sniff to prevent
|
2018-06-02 22:38:38 +00:00
|
|
|
any new occurrences.
|
|
|
|
|
-->
|
|
|
|
|
<exclude-pattern>*/includes/GlobalFunctions\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/includes/libs/filebackend/FSFileBackend\.php</exclude-pattern>
|
2019-05-13 10:38:37 +00:00
|
|
|
<exclude-pattern>*/maintenance/includes/SevenZipStream\.php</exclude-pattern>
|
2018-06-02 22:38:38 +00:00
|
|
|
<exclude-pattern>*/maintenance/populateImageSha1\.php</exclude-pattern>
|
|
|
|
|
</rule>
|
|
|
|
|
<rule ref="MediaWiki.Usage.ForbiddenFunctions.proc_open">
|
|
|
|
|
<!--
|
2021-04-18 15:22:58 +00:00
|
|
|
Continue to allow existing violations, but enable the sniff to prevent
|
2018-06-02 22:38:38 +00:00
|
|
|
any new occurrences.
|
|
|
|
|
-->
|
2021-04-20 22:08:18 +00:00
|
|
|
<exclude-pattern>*/includes/export/DumpPipeOutput\.php</exclude-pattern>
|
2022-05-06 09:09:56 +00:00
|
|
|
<exclude-pattern>*/includes/ResourceLoader/Image\.php</exclude-pattern>
|
2021-04-20 22:08:18 +00:00
|
|
|
<exclude-pattern>*/includes/shell/Command\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/includes/TextPassDumper\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/mysql\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/storage/recompressTracked\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/tests/parser/editTests\.php</exclude-pattern>
|
2018-06-02 22:38:38 +00:00
|
|
|
</rule>
|
|
|
|
|
<rule ref="MediaWiki.Usage.ForbiddenFunctions.shell_exec">
|
|
|
|
|
<!--
|
2021-04-18 15:22:58 +00:00
|
|
|
Continue to allow existing violations, but enable the sniff to prevent
|
2018-06-02 22:38:38 +00:00
|
|
|
any new occurrences.
|
|
|
|
|
-->
|
|
|
|
|
<exclude-pattern>*/maintenance/mwdocgen\.php</exclude-pattern>
|
|
|
|
|
<exclude-pattern>*/maintenance/updateCredits\.php</exclude-pattern>
|
|
|
|
|
</rule>
|
|
|
|
|
<rule ref="MediaWiki.Usage.ForbiddenFunctions.system">
|
|
|
|
|
<!--
|
2021-04-18 15:22:58 +00:00
|
|
|
Continue to allow existing violations, but enable the sniff to prevent
|
2018-06-02 22:38:38 +00:00
|
|
|
any new occurrences.
|
|
|
|
|
-->
|
|
|
|
|
<exclude-pattern>*/maintenance/mwdocgen\.php</exclude-pattern>
|
|
|
|
|
</rule>
|
2019-03-02 03:06:54 +00:00
|
|
|
<rule ref="MediaWiki.Commenting.MissingCovers.MissingCovers">
|
2021-04-20 22:08:18 +00:00
|
|
|
<exclude-pattern>*/tests/phpunit/structure/*</exclude-pattern>
|
2019-03-02 03:06:54 +00:00
|
|
|
</rule>
|
2021-01-30 00:29:35 +00:00
|
|
|
<rule ref="Generic.Arrays.DisallowShortArraySyntax">
|
|
|
|
|
<!--
|
|
|
|
|
T273340: Rule not to be enabled on any other file.
|
|
|
|
|
PHPVersionCheck.php requires syntax to be old PHP compatible.
|
|
|
|
|
The rest should therefore use [] rather than array() as per the
|
|
|
|
|
MediaWiki style guide.
|
|
|
|
|
-->
|
|
|
|
|
<include-pattern>includes/PHPVersionCheck\.php</include-pattern>
|
|
|
|
|
</rule>
|
2017-07-01 08:32:08 +00:00
|
|
|
<file>.</file>
|
|
|
|
|
<arg name="encoding" value="UTF-8"/>
|
2021-04-20 22:08:18 +00:00
|
|
|
<arg name="extensions" value="php"/>
|
|
|
|
|
<exclude-pattern type="relative">^(extensions|skins)/*</exclude-pattern>
|
|
|
|
|
<exclude-pattern>LocalSettings(-installer)?\.php</exclude-pattern>
|
2015-06-29 21:35:38 +00:00
|
|
|
</ruleset>
|