[Phpmyadmin-devel] CheckStyle violations in export files

Madhura Jayaratne madhura.cj at gmail.com
Sat Jul 30 04:24:35 CEST 2011

On Sat, Jul 30, 2011 at 5:22 AM, Dieter Adriaenssens <
dieter.adriaenssens at gmail.com> wrote:

> 2011/7/22 Madhura Jayaratne <madhura.cj at gmail.com>:
> > Hi all,
> > Looking at the CheckStyle reports from the CI, all the export files show
> > very high counts of indentation rule violations.
> > The code in the 'else' block of 'if (isset($plugin_list))' condition is
> > wrongly indented in all of these files.
> > There are two possible ways to correct this.
> > 1) Correctly indent the 'else' block
> > 2) Add 'return' statement to the end of 'if' block and remove 'else {'
> part.
> > Which one if preferred?
> Looking at the code (I only checked sql.php and xml.php) I wonder why
> the different functions are defined within the 'else' block. This
> doesn't seem right to me. There must be cleaner ways of conditionally
> defining a function than putting them in an if/else block. I'm not
> sure even how the php compiler parses this? Anyway I don't think we
> can rely on the behaviour of the php compiler to not define these
> functions.

Since we did not have any bug reports about such a problem I believe most of
the compilers, if not all, work as expected with the if/else block. But as
you mentioned, it would be nice to have a cleaner mechanism to do this.

When I sent the earlier mail I was under the impression that a 'return'
statement as the last line of the 'if' block would let me remove the else
block, which would correct those CheckStyle violations. I was comparing this
to the import plugins. However since export plugins contains methods in the
'else' blocks, this is not possible. It amounts to redefining, already
defined methods and I have to give it up.

Thanks and Regards,

Madhura Jayaratne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20110730/e0ed7a06/attachment.html>

More information about the Developers mailing list