<div dir="ltr"><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:0 0 0 .8ex;border-left:1px #ccc 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">marc@infomarc.info</a> <mailto:<a href="mailto:marc@infomarc.info">marc@infomarc.info</a>>><br>
<div><div class="h5">><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">Phpmyadmin-devel@lists.sourceforge.net</a><br>
</div></div>> <mailto:<a href="mailto:Phpmyadmin-devel@lists.sourceforge.net">Phpmyadmin-devel@lists.sourceforge.net</a>><br>
<div class="im">> <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 class="HOEnZb"><div class="h5"><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">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 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><div class="gmail_extra"><br></div><div class="gmail_extra">Hugues.</div></div>