Hi
Dne Sun, 05 Jan 2014 09:36:10 -0500
Marc Delisle <marc(a)infomarc.info> napsal(a):
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…
Looking at current long variable names, I see following patterns:
- pma prefix, is that really needed? [1]
- return values from function called $something_somewhere_html, using
just $result might be even better to understand in this context [2]
- some variables still being used as globals, thus needing to provide
too much context in their names [3]
- 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/DisplayRe…
[
3]:https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/mysql_cha…
[
4]:https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/DisplayRe…
--
Michal Čihař |
http://cihar.com |
http://phpmyadmin.net