<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2013/12/17 Hugues Peccatte <span dir="ltr"><<a href="mailto:hugues.peccatte@gmail.com" target="_blank">hugues.peccatte@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr"><div><div class="h5"><div class="gmail_extra"><div class="gmail_quote">2013/12/16 Marc Delisle <span dir="ltr"><<a href="mailto:marc@infomarc.info" target="_blank">marc@infomarc.info</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


Le 2013-12-16 13:12, Hugues Peccatte a écrit :<br>
> 2013/12/16 Marc Delisle <<a href="mailto:marc@infomarc.info" target="_blank">marc@infomarc.info</a> <mailto:<a href="mailto:marc@infomarc.info" target="_blank">marc@infomarc.info</a>>><br>
<div><div>><br>
>     Le 2013-12-15 14:36, Hugues Peccatte a écrit :<br>
>     > Hi,<br>
>     ><br>
>     > What would you think about using the "nesting level" sniff please?<br>
>     > This sniff permits to detect when there are too much nested levels<br>
>     like:<br>
>     > if (...) {<br>
>     >     if (...) {<br>
>     >         if (...) {<br>
>     >             if (...) {<br>
>     >                 if (...) {<br>
>     >                     ....<br>
>     >                 }<br>
>     >             }<br>
>     >         }<br>
>     >     }<br>
>     > }<br>
>     ><br>
>     > This kind of syntax often means that a refactoring is needed or a<br>
>     rewrite.<br>
>     ><br>
>     > I can add it myself if you agree.<br>
>     ><br>
><br>
>     Good idea but how many levels is considered "too many"?  Can you give an<br>
>     example of nesting levels you found?<br>
><br>
><br>
>     --<br>
>     Marc Delisle<br>
>     <a href="http://infomarc.info" target="_blank">http://infomarc.info</a> | <a href="http://phpmyadmin.net" target="_blank">http://phpmyadmin.net</a><br>
><br>
>     ------------------------------------------------------------------------------<br>
>     Rapidly troubleshoot problems before they affect your business. Most IT<br>
>     organizations don't have a clear picture of how application performance<br>
>     affects their revenue. With AppDynamics, you get 100% visibility<br>
>     into your<br>
>     Java,.NET, & PHP application. Start your 15-day FREE TRIAL of<br>
>     AppDynamics Pro!<br>
>     <a href="http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk" target="_blank">http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk</a><br>
>     _______________________________________________<br>
>     Phpmyadmin-devel mailing list<br>
>     <a href="mailto:Phpmyadmin-devel@lists.sourceforge.net" target="_blank">Phpmyadmin-devel@lists.sourceforge.net</a><br>
</div></div>>     <mailto:<a href="mailto:Phpmyadmin-devel@lists.sourceforge.net" target="_blank">Phpmyadmin-devel@lists.sourceforge.net</a>><br>
<div>>     <a href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a><br>
><br>
><br>
><br>
> Hi,<br>
><br>
> To add this new rule won't add to many PHPCS errors. I already test this<br>
> rule and there are currently not so much this errors in the sources. (I<br>
> don't have an exact count. I would say around 20-30.)<br>
><br>
> See: <a href="http://www.squizlabs.com/php-codesniffer/php_codesniffer-ruleset.xml-support-in-svn" target="_blank">http://www.squizlabs.com/php-codesniffer/php_codesniffer-ruleset.xml-support-in-svn</a><br>
> See: <a href="http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php" target="_blank">http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php</a><br>
><br>
> The rule could be:<br>
>   <rule ref="Generic.Metrics.NestingLevel"><br>
>     <properties><br>
>       <property name="nestingLevel" value="2" /><br>
>       <property name="absoluteNestingLevel" value="5" /><br>
>     </properties><br>
>   </rule><br>
><br>
> We don't need to define both properties.<br>
> "nestingLevel" is the number of nested level which throw a warning.<br>
> (default = 5)<br>
> "absoluteNestingLevel" is the maximum of allowed nested levels. (default<br>
> = 10)<br>
><br>
> I think that the default values don't need to be overridden, so the rule<br>
> would be:<br>
> <rule ref="Generic.Metrics.NestingLevel" /><br>
><br>
> Hugues.<br>
<br>
</div>Yes, let's try that.<br>
<div><div><br>
<br>
--<br>
Marc Delisle<br>
<a href="http://infomarc.info" target="_blank">http://infomarc.info</a> | <a href="http://phpmyadmin.net" target="_blank">http://phpmyadmin.net</a><br>
<br>
------------------------------------------------------------------------------<br>
Rapidly troubleshoot problems before they affect your business. Most IT<br>
organizations don't have a clear picture of how application performance<br>
affects their revenue. With AppDynamics, you get 100% visibility into your<br>
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!<br>
<a href="http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk" target="_blank">http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk</a><br>
_______________________________________________<br>
Phpmyadmin-devel mailing list<br>
<a href="mailto:Phpmyadmin-devel@lists.sourceforge.net" target="_blank">Phpmyadmin-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a><br>
</div></div></blockquote></div><br></div></div></div><div class="gmail_extra">Hi,</div><div class="gmail_extra"><br></div><div class="gmail_extra">I just committed the add of the new rule. Jenkins should find new errors now.</div>

<div class="gmail_extra">
[ ... wait for Jenkins result ... ]</div><div class="gmail_extra">My estimate was almost good. There are 27 new errors because of the nested levels. I think that many of them could be fixed.</div><div class="gmail_extra">


<br></div><div class="gmail_extra">I'll look at this.</div><span class=""><font color="#888888"><div class="gmail_extra"><br></div><div class="gmail_extra">Hugues.</div></font></span></div>
</blockquote></div><br></div><div class="gmail_extra">Hi,</div><div class="gmail_extra"><br></div><div class="gmail_extra">I've just found this page: <a href="https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#For-loop-with-test-function-call">https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples</a></div>

<div class="gmail_extra">You can find here a huge list of sniffs and their descriptions. I think that some of those sniffs could be useful for the phpMyAdmin source code. Let think about:</div><div class="gmail_extra">- <a href="https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#For-loop-with-test-function-call">https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#For-loop-with-test-function-call</a></div>

<div class="gmail_extra">- <a href="https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Unused-function-parameter">https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Unused-function-parameter</a></div>

<div class="gmail_extra">- <a href="https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Inline-control-structure">https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Inline-control-structure</a></div>

<div class="gmail_extra">- <a href="https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Control-signature">https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Control-signature</a></div>

<div class="gmail_extra">- <a href="https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Method-scope">https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Method-scope</a></div>

<div class="gmail_extra">- <a href="https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Always-return">https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Always-return</a></div>

<div class="gmail_extra">- <a href="https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Non-executable-code">https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Non-executable-code</a></div>

<div class="gmail_extra"><br></div><div class="gmail_extra">And there are more sniffs that I like:</div><div class="gmail_extra">- <a href="https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Function-call-argument-spacing">https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Function-call-argument-spacing</a></div>

<div class="gmail_extra">- <a href="https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Concatenation-must-be-surrounded-by-spaces">https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Concatenation-must-be-surrounded-by-spaces</a></div>

<div class="gmail_extra">- <a href="https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Semicolon-spacing">https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Semicolon-spacing</a></div>

<div class="gmail_extra">- <a href="https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Array-bracket-spacing">https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Array-bracket-spacing</a></div>

<div class="gmail_extra"><br></div><div class="gmail_extra">(Yes, I'm a little bit annoying with code style...)</div><div class="gmail_extra"><br></div><div class="gmail_extra">TYPO3 seems to be another standard. I believe that I selected 1 or 2 of their sniffs. Maybe we could imagine to use it, but I never used it, for now at least...</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">Please, let me know what you think about those sniffs, if some seems useful or useless.</div><div class="gmail_extra">I'll try to use it locally and give you more information about number of errors/warnings thrown by those sniffs.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">Thanks,</div><div class="gmail_extra">Hugues.</div></div>