Michal Čihař a écrit :
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…
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 :) )
Looking at current long variable names, I see following patterns:
- pma prefix, is that really needed? [1]
No.
- return values from function called $something_somewhere_html, using
just $result might be even better to understand in this context [2]
Agreed, when
it's inside a function.
- some variables still being used as globals, thus needing to provide
too much context in their names [3]
Usually a hint that this code segment needs
refactoring.
- some probably legitimate usages of long name [4]
Agreed.
[
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…
------------------------------------------------------------------------
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.cl…
------------------------------------------------------------------------
_______________________________________________
Phpmyadmin-devel mailing list
Phpmyadmin-devel(a)lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
--
Marc Delisle
http://infomarc.info |
http://phpmyadmin.net