Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#833 inconsistent coding standard again

fixed
nobody
None
5
2013-06-11
2005-12-01
Xuefer
No

i once submit a bug about coding inconsistent problem,
and it's accepted nicely.
"if(...)" to "if (...)"
"foreach(...)" to "foreach (...)"

but now i see something similar again.
reason: phpmyadmin claim itself as a example for php
begginers.
problem: coding standard is not consistent
actual code:
"func(arg, arg)" verus "func( arg, arg )" in
server_processlist.php
most pma programmer write the former, except cybot_tm
who write the latter format
======
2.0 (nijel 18-Nov-03): if (!empty($kill)) {
2.5 (rabus 22-Jan-04): if
(PMA_DBI_try_query('KILL ' . $kill . ';')) {
2.0 (nijel 18-Nov-03): $message =
sprintf($strThreadSuccessfullyKilled, $kill);
2.0 (nijel 18-Nov-03): } else {
2.0 (nijel 18-Nov-03): $message =
sprintf($strCouldNotKill, $kill);
2.0 (nijel 18-Nov-03): }
2.0 (nijel 18-Nov-03): }
======
2.12 (cybot_tm 13-Oct-05): $sql_query
= 'SHOW' . ( empty( $full ) ? '' : ' FULL' ) . '
PROCESSLIST';
2.12 (cybot_tm 13-Oct-05): $serverProcesses =
PMA_DBI_fetch_result( $sql_query );
2.0 (nijel 18-Nov-03):
2.12 (cybot_tm 13-Oct-05): PMA_showMessage(
$GLOBALS['strSuccess'] );

"arg,arg" vs "arg, arg" in libraries/common.lib.php

2.226 (cybot_tm 28-Nov-05): $path =
preg_replace('@\.\.*@','.',$path);
======
2.226 (cybot_tm 28-Nov-05): if (
is_array( $_db_tooltip ) ) {
2.226 (cybot_tm 28-Nov-05):
$db_tooltip = implode( ' ', $_db_tooltip );
2.226 (cybot_tm 28-Nov-05): }

Discussion

  • Xuefer
    Xuefer
    2005-12-01

    Logged In: YES
    user_id=185131

    btw, i'm not the one to propose which standard phpmyadmin
    should use. but the point is a consistent standard.

     
  • Michal Čihař
    Michal Čihař
    2005-12-01

    Logged In: YES
    user_id=192186

    We recommend PEAR Coding Standards in documentation, so we
    should actually use it ;-)

    http://pear.php.net/manual/en/standards.php

     
  • Logged In: YES
    user_id=326580

    PEAR coding standard does nat say anything about spaces
    before/after open/closing brackets.

    (yes i see they use no spaces in his exmaples, but its not
    mentioned anywhere)

    so this is undefined to me

     
  • Xuefer
    Xuefer
    2005-12-01

    Logged In: YES
    user_id=185131

    http://pear.php.net/manual/en/standards.funcalls.php
    [quote]
    Functions should be called with no spaces between the
    function name, the opening parenthesis, and the first
    parameter; spaces between commas and each parameter, and no
    space between the last parameter, the closing parenthesis,
    and the semicolon.
    [/quote]

     
  • Logged In: YES
    user_id=326580

    ooh

     
  • Marc Delisle
    Marc Delisle
    2005-12-04

    Logged In: YES
    user_id=210714

    Note that in the PEAR standard they recommend to put the
    brace on the same line for control structure:
    if ($foo) {

    but on the next line for function definitions:
    function foo($bar)
    {

     
  • Marc Delisle
    Marc Delisle
    2005-12-04

    Logged In: YES
    user_id=210714

    Hmmm, constants must be uppercase, except for true, false
    and null that must be lowercase. Why? :)

    http://pear.php.net/manual/en/standards.naming.php

     
    • milestone: 284140 -->
    • status: open --> open-accepted
     
  • Logged In: YES
    user_id=326580

    moved into feature request

     
  • Michal Čihař
    Michal Čihař
    2011-03-02

    I think this should not be the case anymore. If you find some specific issues, please report them separately.

     
  • Michal Čihař
    Michal Čihař
    2011-03-02

    • status: open-accepted --> pending-fixed
     
    • status: pending-fixed --> closed-fixed
     
  • This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • Michal Čihař
    Michal Čihař
    2013-06-11

    • Status: closed-fixed --> fixed