>> I'm aware that I'm opening a can of worms, but can we discuss PHPMD rules?
>
> I think those were never actually discussed, we just run then in
> Jenkins. So I think it's good idea to discuss coding style beyond
> indentation and whitespaces.
>
>> In particular, I find that to obey the maximum variable name (20
>> characters) rule, one has to sometimes abbreviate at the expanse of clarity.
>
> I think this is quite connected to line length as well. In case you
> have longer variable names and stick with current line length, the code
> will be a bit harder to read due to necessary wrapping, for example:
>
> https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/browse_foreigners.lib.php#L152
I see two possibilities here:
- abbreviate variable names (would make them even more difficult to
understand)
- improve the logic (I'll work on this case :) )
No.
>
> Looking at current long variable names, I see following patterns:
>
> - pma prefix, is that really needed? [1]
Agreed, when it's inside a function.
>
> - return values from function called $something_somewhere_html, using
> just $result might be even better to understand in this context [2]
Usually a hint that this code segment needs refactoring.
>
> - some variables still being used as globals, thus needing to provide
> too much context in their names [3]
>Agreed.
> - some probably legitimate usages of long name [4]
>
> [1]:https://github.com/phpmyadmin/phpmyadmin/blob/master/view_create.php#L95
> [2]:https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/DisplayResults.class.php#L5203
> [3]:https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/mysql_charsets.inc.php#L17
> [4]:https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/DisplayResults.class.php#L2779