Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405735 )
Change subject: [WIP] Update Wikibase CodeSniffer to 0.3.x ...................................................................... [WIP] Update Wikibase CodeSniffer to 0.3.x The only controversial detail I can see for now is if we really want a sniff that disallows "list ()" with a space. Personally I don't mind. Please state your opionin at https://github.com/wmde/WikibaseCodeSniffer/pull/18 Change-Id: I7f9c192cb51057685e0d67742bb8446d995308a8 --- R client/tests/phpunit/includes/Hooks/BaseTemplateAfterPortletHandlerTest.php M composer.json M phpcs.xml M repo/includes/Api/EntitySearchTermIndex.php M repo/tests/phpunit/includes/Api/EditEntityTest.php M repo/tests/phpunit/includes/Api/SetAliasesTest.php M repo/tests/phpunit/includes/Api/SetDescriptionTest.php M repo/tests/phpunit/includes/Api/SetLabelTest.php M repo/tests/phpunit/includes/Api/SetSiteLinkTest.php 9 files changed, 22 insertions(+), 18 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/35/405735/1 diff --git a/client/tests/phpunit/includes/Hooks/BaseTemplateAfterPortalHandlerTest.php b/client/tests/phpunit/includes/Hooks/BaseTemplateAfterPortletHandlerTest.php similarity index 100% rename from client/tests/phpunit/includes/Hooks/BaseTemplateAfterPortalHandlerTest.php rename to client/tests/phpunit/includes/Hooks/BaseTemplateAfterPortletHandlerTest.php diff --git a/composer.json b/composer.json index df88468..5fda6e4 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ }, "require-dev": { "jakub-onderka/php-parallel-lint": ">=0.3 <0.10", - "wikibase/wikibase-codesniffer": "^0.2.0", + "wikibase/wikibase-codesniffer": "^0.3.0", "jakub-onderka/php-console-highlighter": "0.3.2", "mediawiki/minus-x": "0.2.1" }, diff --git a/phpcs.xml b/phpcs.xml index 757ccc1..d1f49f3 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,8 +1,6 @@ <?xml version="1.0"?> -<ruleset name="Wikibase"> - <rule ref="./vendor/wikibase/wikibase-codesniffer/Wikibase"/> - - <!-- Exceptions --> +<ruleset> + <rule ref="./vendor/wikibase/wikibase-codesniffer/Wikibase" /> <rule ref="Generic.Files.LineLength"> <properties> @@ -17,7 +15,14 @@ <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"> <exclude-pattern>WikibaseClient\.example\.php</exclude-pattern> </rule> - <rule ref="Generic.Files.OneClassPerFile"> + <rule ref="MediaWiki.Files.ClassMatchesFilename"> + <exclude-pattern>/maintenance/</exclude-pattern> + <exclude-pattern>build/generateAutoload\.php</exclude-pattern> + <exclude-pattern>repo/tests/testDispatchCoordinator\.php</exclude-pattern> + <!-- FIXME: These files should be renamed to match their class name. --> + <exclude-pattern>Wikibase*\.hooks\.php</exclude-pattern> + </rule> + <rule ref="MediaWiki.Files.OneClassPerFile"> <exclude-pattern>Scribunto_LuaWikibaseLibraryTestCase</exclude-pattern> </rule> <rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses"> @@ -26,8 +31,6 @@ <rule ref="Squiz.Classes.ValidClassName.NotCamelCaps"> <exclude-pattern>Scribunto_LuaWikibase*Library</exclude-pattern> </rule> - - <!-- Additions --> <!-- Metrics are intentionally not part of the base Wikibase CodeSniffer rule set. --> <rule ref="Generic.Metrics.CyclomaticComplexity"> @@ -39,6 +42,7 @@ <rule ref="Generic.Metrics.NestingLevel" /> <file>.</file> + <exclude-pattern>repo/tests/browser</exclude-pattern> <exclude-pattern>view/lib/wikibase-api/WikibaseJavaScriptApi.php</exclude-pattern> <exclude-pattern type="relative">^extensions/</exclude-pattern> </ruleset> diff --git a/repo/includes/Api/EntitySearchTermIndex.php b/repo/includes/Api/EntitySearchTermIndex.php index 1cff8f2..48f2525 100644 --- a/repo/includes/Api/EntitySearchTermIndex.php +++ b/repo/includes/Api/EntitySearchTermIndex.php @@ -198,7 +198,7 @@ // NOTE: this assumes entities of the particular type are only provided by a single repository // This assumption is currently valid but might change in the future. - list ( $repositoryPrefix, ) = $this->entityTypeToRepositoryMapping[$entityType][0]; + list( $repositoryPrefix, ) = $this->entityTypeToRepositoryMapping[$entityType][0]; try { $id = $this->idParser->parse( EntityId::joinSerialization( [ diff --git a/repo/tests/phpunit/includes/Api/EditEntityTest.php b/repo/tests/phpunit/includes/Api/EditEntityTest.php index 94287c0..e2ac3a5 100644 --- a/repo/tests/phpunit/includes/Api/EditEntityTest.php +++ b/repo/tests/phpunit/includes/Api/EditEntityTest.php @@ -485,7 +485,7 @@ 'new' => 'item', 'data' => '{"labels":{"en":{"language":"en","value":"something"}}}' ]; - list ( $result, ) = $this->doApiRequestWithToken( $createItemParams, null, $user ); + list( $result, ) = $this->doApiRequestWithToken( $createItemParams, null, $user ); return $result['entity']; } diff --git a/repo/tests/phpunit/includes/Api/SetAliasesTest.php b/repo/tests/phpunit/includes/Api/SetAliasesTest.php index 33cf152..e01cbb8 100644 --- a/repo/tests/phpunit/includes/Api/SetAliasesTest.php +++ b/repo/tests/phpunit/includes/Api/SetAliasesTest.php @@ -273,7 +273,7 @@ $newItem = $this->createItemUsing( $userWithAllPermissions ); - list ( $result, ) = $this->doApiRequestWithToken( + list( $result, ) = $this->doApiRequestWithToken( $this->getAddAliasRequestParams( $newItem->getId() ), null, $userWithAllPermissions @@ -316,7 +316,7 @@ '*' => [ 'read' => true, 'edit' => true, 'writeapi' => true ] ] ); - list ( $result, ) = $this->doApiRequestWithToken( + list( $result, ) = $this->doApiRequestWithToken( $this->getCreateItemAndSetAliasRequestParams(), null, $userWithAllPermissions diff --git a/repo/tests/phpunit/includes/Api/SetDescriptionTest.php b/repo/tests/phpunit/includes/Api/SetDescriptionTest.php index 33cc5d5..68ce46e 100644 --- a/repo/tests/phpunit/includes/Api/SetDescriptionTest.php +++ b/repo/tests/phpunit/includes/Api/SetDescriptionTest.php @@ -66,7 +66,7 @@ $newItem = $this->createItemUsing( $userWithAllPermissions ); - list ( $result, ) = $this->doApiRequestWithToken( + list( $result, ) = $this->doApiRequestWithToken( $this->getSetDescriptionRequestParams( $newItem->getId() ), null, $userWithAllPermissions @@ -109,7 +109,7 @@ '*' => [ 'read' => true, 'edit' => true, 'writeapi' => true ] ] ); - list ( $result, ) = $this->doApiRequestWithToken( + list( $result, ) = $this->doApiRequestWithToken( $this->getCreateItemAndSetDescriptionRequestParams(), null, $userWithAllPermissions diff --git a/repo/tests/phpunit/includes/Api/SetLabelTest.php b/repo/tests/phpunit/includes/Api/SetLabelTest.php index d3f7f53..5bc5d17 100644 --- a/repo/tests/phpunit/includes/Api/SetLabelTest.php +++ b/repo/tests/phpunit/includes/Api/SetLabelTest.php @@ -66,7 +66,7 @@ $newItem = $this->createItemUsing( $userWithAllPermissions ); - list ( $result, ) = $this->doApiRequestWithToken( + list( $result, ) = $this->doApiRequestWithToken( $this->getSetLabelRequestParams( $newItem->getId() ), null, $userWithAllPermissions @@ -109,7 +109,7 @@ '*' => [ 'read' => true, 'edit' => true, 'writeapi' => true ] ] ); - list ( $result, ) = $this->doApiRequestWithToken( + list( $result, ) = $this->doApiRequestWithToken( $this->getCreateItemAndSetLabelRequestParams(), null, $userWithAllPermissions diff --git a/repo/tests/phpunit/includes/Api/SetSiteLinkTest.php b/repo/tests/phpunit/includes/Api/SetSiteLinkTest.php index 8afd8cd..d9541a6 100644 --- a/repo/tests/phpunit/includes/Api/SetSiteLinkTest.php +++ b/repo/tests/phpunit/includes/Api/SetSiteLinkTest.php @@ -578,7 +578,7 @@ $newItem = $this->createItemUsing( $userWithAllPermissions ); - list ( $result, ) = $this->doApiRequestWithToken( + list( $result, ) = $this->doApiRequestWithToken( $this->getSetSiteLinkRequestParams( $newItem->getId() ), null, $userWithAllPermissions @@ -621,7 +621,7 @@ '*' => [ 'read' => true, 'writeapi' => true ] ] ); - list ( $result, ) = $this->doApiRequestWithToken( + list( $result, ) = $this->doApiRequestWithToken( $this->getCreateItemAndSetSiteLinkRequestParams(), null, $userWithAllPermissions -- To view, visit https://gerrit.wikimedia.org/r/405735 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7f9c192cb51057685e0d67742bb8446d995308a8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) <thiemo.kr...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits