summaryrefslogtreecommitdiffstats
path: root/docs/sgml/patches.sgml
diff options
context:
space:
mode:
authorbarnboy%trilobyte.net <>2001-08-30 02:25:24 +0200
committerbarnboy%trilobyte.net <>2001-08-30 02:25:24 +0200
commit58593ba9d058e7fdd2fbac2d45dafefcbc6bbb4e (patch)
tree84b3c63571a69482fda0375f9c375d7afa9c0cc3 /docs/sgml/patches.sgml
parent073c47679819c3ff3bfd900c3b9ceeb176232432 (diff)
downloadbugzilla-58593ba9d058e7fdd2fbac2d45dafefcbc6bbb4e.tar.gz
bugzilla-58593ba9d058e7fdd2fbac2d45dafefcbc6bbb4e.tar.xz
Buncha' release updates. Moved all images to
./images so we don't have multiple copies of the same image, fixed these doc bugs (in no particular order): 94949 97070 97071 97114 96498 95970 96677 94953 96501 96679 97068 97191 97192
Diffstat (limited to 'docs/sgml/patches.sgml')
-rw-r--r--docs/sgml/patches.sgml98
1 files changed, 98 insertions, 0 deletions
diff --git a/docs/sgml/patches.sgml b/docs/sgml/patches.sgml
index 3a1ce90d2..3f49255f2 100644
--- a/docs/sgml/patches.sgml
+++ b/docs/sgml/patches.sgml
@@ -247,6 +247,104 @@ RewriteRule ^/([0-9]+)$ http://foo.bar.com/show_bug.cgi?id=$1 [L,R]
</para>
</section>
+ <section id="bzhacking">
+ <title>Hacking Bugzilla</title>
+ <para>
+ What follows are some general guidelines for changing Bugzilla, and adhering to good coding practice while doing so. We've had some checkins in the past which ruined Bugzilla installations because of disregard for these conventions. Sorry for the lack of formatting; I got this info into the Guide on the day of 2.14 release and haven't formatted it yet.
+ </para>
+ <literallayout>
+
+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.
+
+ 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 -
+
+ grep (/$value/, @array);
+
+ If you need to use a non-expression variable inside of an expression, be
+ sure to quote it properly (using \Q..\E).
+
+Coding Style for Bugzilla
+-------------------------
+
+While it's true that not all of the code currently in Bugzilla adheres to
+this 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 :).
+
+ 1. Whitespace
+
+ Bugzilla's prefered indentation is 4 spaces (no tabs, please).
+
+ 2. Curly braces.
+
+ The opening brace of a block should be on the same line as the statement
+ that is causing the block and the closing brace should be at the same
+ indentation level as that statement, for example:
+
+ if ($var) {
+ print "The variable is true";
+ } else {
+ print "Try again";
+ }
+
+ - NOT -
+
+ if ($var)
+ {
+ print "The variable is true";
+ }
+ else
+ {
+ print "Try again";
+ }
+
+ 3. File Names
+
+ File names for bugzilla code and support documention should be legal across
+ multiple platforms. \ / : * ? " < > and | are all illegal characters for
+ filenames on various platforms. Also, file names should not have spaces in
+ them as they can cause confusion in CVS and other mozilla.org utilities.
+
+ 4. Variable Names
+
+ If a variable is scoped globally ($::variable) its name should be descriptive
+ of what it contains. Local variables can be named a bit looser, provided the
+ context makes their content obvious. For example, $ret could be used as a
+ staging variable for a routine's return value as the line |return $ret;| will
+ make it blatently obvious what the variable holds and most likely be shown
+ on the same screen as |my $ret = "";|.
+
+ 5. Cross Database Compatability
+
+ Bugzilla was originally written to work with MySQL and therefore took advantage
+ of some of its features that aren't contained in other RDBMS software. These
+ should be avoided in all new code. Examples of these features are enums and
+ encrypt().
+
+ 6. Cross Platform Compatability
+
+ While Bugzilla was written to be used on Unix based systems (and Unix/Linux is
+ still the only officially supported platform) there are many who desire/need to
+ run Bugzilla on Microsoft Windows boxes. Whenever possible, we should strive
+ not to make the lives of these people any more complicated and avoid doing things
+ that break Bugzilla's ability to run on multiple operating systems.
+
+ </literallayout>
+ </section>
+
</appendix>