<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
>> 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>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><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">
<br>
</div>I see two possibilities here:<br>
- abbreviate variable names (would make them even more difficult to<br>
understand)<br>
- improve the logic (I'll work on this case :)  )<br>
<div class="im"><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 class="im"><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 class="im"><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 class="im">><br>
> - some probably legitimate usages of long name [4]<br>
</div>Agreed.<br>
<div class="im"><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>-- <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>