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_forei…
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.
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)
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 ?)
I agree. But is it possible to change the allowed length ?
Here we are talking about PMD (