Skip to content

Commit

Permalink
Search: Add PHPCS config in search dir
Browse files Browse the repository at this point in the history
Bug: T384213
Change-Id: Ie86befc491f7f2020bff85d9979c82aeffd6c56c
  • Loading branch information
dima koushha committed Jan 30, 2025
1 parent dd8ffac commit 00cb74a
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@
"lint": "parallel-lint . --exclude vendor --exclude node_modules --exclude .git --exclude lib/packages/*/*/vendor",
"phpcs": "phpcs -p -s --cache",
"phpcs:rest-api": "phpcs -p -s --standard=./repo/domains/crud/ruleset.xml repo/domains/crud/",
"phpcs:search": "phpcs -p -s --standard=./repo/domains/search/ruleset.xml repo/domains/search/",
"phpcs-modified": "bash build/phpcsGitModified.sh",
"phpcs-committed": "bash build/phpcsGitCommitted.sh",
"fix": [
"minus-x fix .",
"phpcbf --standard=./repo/domains/crud/ruleset.xml repo/domains/crud/",
"phpcbf --standard=./repo/domains/search/ruleset.xml repo/domains/search/",
"phpcbf"
],
"fix-modified": "bash build/phpcbfGitModified.sh",
Expand All @@ -74,6 +76,7 @@
"composer lint",
"composer phpcs",
"composer phpcs:rest-api",
"composer phpcs:search",
"composer phpstan",
"minus-x check ."
],
Expand Down
42 changes: 42 additions & 0 deletions repo/domains/search/ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0"?>
<ruleset name="search">
<!-- This is not a standalone ruleset, but an extension of Wikibase's main phpcs config.
It is invoked separately to prevent the two rule sets from interfering with each other. -->

<rule ref="Generic.PHP.RequireStrictTypes" />
<rule ref="Generic.WhiteSpace.ScopeIndent" />
<rule ref="Generic.Arrays.ArrayIndent" />
<rule ref="PEAR.Functions.FunctionCallSignature.Indent" />
<rule ref="Squiz.Strings.DoubleQuoteUsage">
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar" />
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.UselessAnnotation" />
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation" />
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint" />
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array">
<element key="repo/domains/search/src" value="Wikibase\Repo\Domains\Search"/>
<element key="repo/domains/search/tests/phpunit" value="Wikibase\Repo\Tests\Domains\Search"/>
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration">
<properties>
<property name="spacesCountAfterKeyword" value="0"/>
</properties>
</rule>

<arg name="tab-width" value="4" />
<arg name="extensions" value="php" />
<exclude-pattern>node_modules/*</exclude-pattern>
</ruleset>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare( strict_types=1 );

namespace Wikibase\Repo\Domains\Search\Application\UseCases\SimpleItemSearch\SimpleItemSearch;
namespace Wikibase\Repo\Tests\Domains\Search\Application\UseCases\SimpleItemSearch;

use PHPUnit\Framework\TestCase;
use Wikibase\Repo\Domains\Search\Application\UseCases\SimpleItemSearch\SimpleItemSearch;
Expand Down

0 comments on commit 00cb74a

Please sign in to comment.