D.5. Hacking Bugzilla

The following is a guide for reviewers when checking code into Bugzilla's CVS repostory at mozilla.org. If you wish to submit patches to Bugzilla, you should follow the rules and style conventions below. Any code that does not adhere to these basic rules will not be added to Bugzilla's codebase.

D.5.1. Things that have caused problems and should be avoided

  1. Usage of variables in Regular Expressions

    It is very important that you don't use a variable in a regular expression unless that variable is supposed to contain an expression. This especially applies when using grep. You should use:

    grep ($_ eq $value, @array);
                

    -- NOT THIS --

    grep (/$value/, @array);
                

    Note

    If you need to use a non-expression variable inside of an expression, be sure to quote it properly (using \Q..\E).

D.5.2. Coding Style for Bugzilla

While it's true that not all of the code currently in Bugzilla adheres to this (or any) styleguide, it is something that is being worked toward. Therefore, we ask that all new code (submitted patches and new files) follow this guide as closely as possible (if you're only changing 1 or 2 lines, you don't have to reformat the entire file :).

The Bugzilla development team has decided to adopt the perl style guide as published by Larry Wall. This giude can be found in "Programming Perl" (the camel book) or by typing man perlstyle at your favorite shell prompt.

What appears below if a brief summary, please refer to the perl style guide if you don't see your question covered here.