mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-11 17:02:28 +00:00
build: Rewrite exclude rule Generic.CodeAnalysis.AssignmentInCondition
The <exclude name=".."/> is managed by libup and when a rule passed, it get removed from the list. Failing rules on update are added. Setting the severity for the rule to none avoid that this is changed by libup and it is more visible, that the disable is wanted and there is nothing to "fix" as usually assumend for sniffs in the exclude list. Follow-Up: I8adfdce01ea96f4b62dabd3dea130f9593c7e5ac Change-Id: If42dade02c6ceed1e00f5a3dc846e1578b960ca6
This commit is contained in:
parent
31d67dd8e7
commit
2308d9bba0
30
.phpcs.xml
30
.phpcs.xml
|
@ -1,22 +1,24 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<ruleset>
|
<ruleset>
|
||||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
|
||||||
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.Found" />
|
|
||||||
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition" />
|
|
||||||
<!--
|
|
||||||
Code such as this:
|
|
||||||
while ( ( $foo = $foo->nextSibling ) && someCondition( $foo ) ) { … }
|
|
||||||
is often convenient when working on DOM tree structures, which we do a lot of in this extension.
|
|
||||||
|
|
||||||
It's particularly helpful in combination with Phan, which can infer that `$foo` is non-null from
|
<!--
|
||||||
the code above, but it can't infer that `$foo->nextSibling` is non-null in code like this:
|
Code such as this:
|
||||||
while ( $foo->nextSibling && someCondition( $foo->nextSibling ) ) { … }
|
while ( ( $foo = $foo->nextSibling ) && someCondition( $foo ) ) { … }
|
||||||
|
is often convenient when working on DOM tree structures, which we do a lot of in this extension.
|
||||||
|
|
||||||
When the variable is the only condition, we add extra parentheses to indicate that it isn't a
|
It's particularly helpful in combination with Phan, which can infer that `$foo` is non-null from
|
||||||
typo for `==`, which is a convention borrowed from C:
|
the code above, but it can't infer that `$foo->nextSibling` is non-null in code like this:
|
||||||
while ( ( $foo = $foo->nextSibling ) ) { … }
|
while ( $foo->nextSibling && someCondition( $foo->nextSibling ) ) { … }
|
||||||
-->
|
|
||||||
|
When the variable is the only condition, we add extra parentheses to indicate that it isn't a
|
||||||
|
typo for `==`, which is a convention borrowed from C:
|
||||||
|
while ( ( $foo = $foo->nextSibling ) ) { … }
|
||||||
|
-->
|
||||||
|
<rule ref="Generic.CodeAnalysis.AssignmentInCondition">
|
||||||
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<file>.</file>
|
<file>.</file>
|
||||||
<arg name="extensions" value="php" />
|
<arg name="extensions" value="php" />
|
||||||
<arg name="encoding" value="UTF-8" />
|
<arg name="encoding" value="UTF-8" />
|
||||||
|
|
Loading…
Reference in a new issue