<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra">

<div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div>
>> I'm aware that I'm opening a can of worms, but can we discuss PHPMD rules?<br>
><br>
> I think those were never actually discussed, we just run then in<br>
> Jenkins. So I think it's good idea to discuss coding style beyond<br>
> indentation and whitespaces.<br>
><br>
>> In particular, I find that to obey the maximum variable name (20<br>
>> characters) rule, one has to sometimes abbreviate at the expanse of clarity.<br>
><br>
> I think this is quite connected to line length as well. In case you<br>
> have longer variable names and stick with current line length, the code<br>
> will be a bit harder to read due to necessary wrapping, for example:<br>
><br>
> <a href="https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/browse_foreigners.lib.php#L152" target="_blank">https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/browse_foreigners.lib.php#L152</a><br>




</div></blockquote><div><br></div></div><div>I think the length of a variable name we should use is depend on variable scope and complexity of the code segment. Less complexity code segment may have shorten variable name while more complex code segment will have lengthy variable names. Same for the scope as well. I prefer to have bit lengthy variable since it will self describe the code even without the comments.<br>




<br></div><div>In case we care on the length, we can use comments on a variable initializing point, which describe the shorten variable clearly. As well as using camel case naming convention will save us from additional underscores ($getEntryById < $get_entry_by_id)<br>




<br></div><div>But as a standard we better have a limitation on the length of a variable name. But I think we better keep the limit more than 20 (what about 25 ?)<br></div></div></div></div></blockquote><div><br></div></div>

<div>

I agree. But is it possible to change the allowed length ? </div><div>Here we are talking about PMD (<a href="http://ci.phpmyadmin.net/job/phpMyAdmin/910/pmdResult/type.811406648/" target="_blank">http://ci.phpmyadmin.net/job/phpMyAdmin/910/pmdResult/type.811406648/</a>), so I believe that we can't…</div>

</div></div></div></blockquote><div><br></div><div>Does that mean we must follow these PMD rules?<br>Btw, I think customizing a PMD rule should be possible. Information in the documentation [0] will be useful for find that out.<br>
</div><div>But I have no idea on how PMD works with Jenkins.<br></div><div>
 <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>I see two possibilities here:<br>

</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


- abbreviate variable names (would make them even more difficult to<br>
understand)<br>
- improve the logic (I'll work on this case :)  )<br>
<div><br>
><br>
> Looking at current long variable names, I see following patterns:<br>
><br>
> - pma prefix, is that really needed? [1]<br>
</div>No.<br>
<div><br>
><br>
> - return values from function called $something_somewhere_html, using<br>
>   just $result might be even better to understand in this context [2]<br>
</div>Agreed, when it's inside a function.<br>
<div><br>
><br>
> - some variables still being used as globals, thus needing to provide<br>
>   too much context in their names [3]<br>
</div>Usually a hint that this code segment needs refactoring.<br>
<div>><br>
> - some probably legitimate usages of long name [4]<br>
</div>Agreed.<br>
<div><br>
><br>
> [1]:<a href="https://github.com/phpmyadmin/phpmyadmin/blob/master/view_create.php#L95" target="_blank">https://github.com/phpmyadmin/phpmyadmin/blob/master/view_create.php#L95</a><br>
> [2]:<a href="https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/DisplayResults.class.php#L5203" target="_blank">https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/DisplayResults.class.php#L5203</a><br>





> [3]:<a href="https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/mysql_charsets.inc.php#L17" target="_blank">https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/mysql_charsets.inc.php#L17</a><br>





> [4]:<a href="https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/DisplayResults.class.php#L2779" target="_blank">https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/DisplayResults.class.php#L2779</a><br>




</div></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote><div><br>[0] : <a href="http://pmd.sourceforge.net/pmd-5.0.5/howtowritearule.html" target="_blank">http://pmd.sourceforge.net/pmd-5.0.5/howtowritearule.html</a><br>

</div></div><br>-- <br><font size="4">Chanaka Dharmarathna<br></font><div><font color="#999999"><b>Virtusa (Pvt) Ltd. | </b></font><b style="color:rgb(153,153,153)">Sri Lanka</b></div>
</div></div>