jenkins-bot has submitted this change and it was merged.

Change subject: Separate the warnings for not running wfProfileOut() before 
throwing an exception.
......................................................................


Separate the warnings for not running wfProfileOut() before throwing an 
exception.

Generally this won't be desired, given that it creates a lot of boilerplate 
code,
we are not (usually) catching the exception, and is not even accurate, since we
will miss exceptions raised from calls down the stack.

Change-Id: I14bdcee4e709d09919181b5ec9234e162fc8d6e5
---
M check-vars.php
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Demon: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/check-vars.php b/check-vars.php
index 4680f35..8deb086 100755
--- a/check-vars.php
+++ b/check-vars.php
@@ -131,7 +131,9 @@
                'this-in-static' => true,
                'missed-docblock' => false,
                'profileout' => false,
+               'profileout-throw' => false,
                'matchingprofiles' => true,
+               'matchingprofiles-throw' => false, // Expect to run the 
wfProfileOut() before throwing an exception
                'evil-@' => false,
                'global-in-switch' => true,
                'global-as-local' => true,
@@ -671,14 +673,14 @@
                                                                        for ($i 
= $this->mProfileStackIndex - $this->mConditionalProfileOutCount; $i > 0; $i--) 
{
                                                                                
$missingCalls[] = 'wfProfileOut(' . $this->mProfileStack[$i - 1]['args'] . ')';
                                                                        }
-                                                                       
$this->warning( 'matchingprofiles', "$token[1] in line $token[2] without 
calling " . implode( ', ', $missingCalls ) );
+                                                                       
$this->warning( $token[0] == T_THROW ? 'matchingprofiles-throw' : 
'matchingprofiles', "$token[1] in line $token[2] without calling " . implode( 
', ', $missingCalls ) );
                                                                }
                                                                
$this->mConditionalProfileOutCount = 0;
 
                                                                if ( 
$this->mAfterProfileOut == 2 ) {
                                                                        
$this->mAfterProfileOut = 0;
                                                                } else {
-                                                                       
$this->warning( 'profileout', "$token[1] in line $token[2] is not preceded by 
wfProfileOut" );
+                                                                       
$this->warning( $token[0] == T_THROW ? 'profileout-throw' : 'profileout', 
"$token[1] in line $token[2] is not preceded by wfProfileOut" );
                                                                }
                                                        } elseif ( $token[0] == 
T_FUNCTION ) {
                                                                // We are 
already inside a function, so we must be entering an anonymous function

-- 
To view, visit https://gerrit.wikimedia.org/r/42961
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I14bdcee4e709d09919181b5ec9234e162fc8d6e5
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/tools/code-utils
Gerrit-Branch: master
Gerrit-Owner: Platonides <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: Platonides <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to