From d7f381254270028c7d239463521005f576575151 Mon Sep 17 00:00:00 2001 From: "jake%acutex.net" <> Date: Sat, 19 Jan 2002 07:26:39 +0000 Subject: Latest version of compiled docs (picking up recent SGML changes). --- docs/html/bzhacking.html | 194 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 134 insertions(+), 60 deletions(-) (limited to 'docs/html/bzhacking.html') diff --git a/docs/html/bzhacking.html b/docs/html/bzhacking.html index f867ff5bd..6727dfa88 100644 --- a/docs/html/bzhacking.html +++ b/docs/html/bzhacking.html @@ -19,7 +19,7 @@ REL="NEXT" TITLE="GNU Free Documentation License" HREF="gfdl.html">

D.5. Hacking Bugzilla

The following is a guide for reviewers when checking code into Bugzilla's +> 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

  • Usage of variables in Regular Expressions +> Usage of variables in Regular Expressions

    It is very important that you don't use a variable in a regular +> 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:

    -- NOT THIS -- +> -- NOT THIS --

    grep ($_ eq $value, @array);
    +CLASS="programlisting"
    +>
grep ($_ eq $value, @array);
                 

    grep (/$value/, @array);
    +CLASS="programlisting"
    +>
grep (/$value/, @array);
                 

    If you need to use a non-expression variable inside of an expression, be +> 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 +> 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 +> 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. +> What appears below if a brief summary, please refer to the perl style + guide if you don't see your question covered here. It is much better to submit + a patch which fails these criteria than no patch at all, but please try to meet + these minimum standards when submitting code to Bugzilla.

    • Whitespace +> Whitespace

      Bugzilla's prefered indentation is 4 spaces (no tabs, please). +> Bugzilla's prefered indentation is 4 spaces (no tabs, please).

    • Curly braces. +> Curly braces.

      The opening brace of a block should be on the same line as the statement +> 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) {
    +CLASS="programlisting"
    +>
if ($var) {
         print "The variable is true";
     }
     else {
    @@ -252,20 +254,20 @@ else {
     >
               

    -- NOT THIS -- +> -- NOT THIS --

    if ($var)
    +CLASS="programlisting"
    +>
if ($var)
     {
         print "The variable is true";
     }
    @@ -283,16 +285,27 @@ else
     >
  • File Names +> Cookies +

    Bugzilla uses cookies to ease the user experience, but no new patches + should require user-side cookies. +

  • File Names

    File names for bugzilla code and support documention should be legal across +> 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 @@ -301,50 +314,111 @@ CLASS="COMPUTEROUTPUT" >

  • Variable Names +> Javascript dependencies +

    While Bugzilla uses Javascript to make the user experience easier, no patch + to Bugzilla should require Javascript. +

  • Patch Format +

    All patches submitted for inclusion into Bugzilla should be in the form of a + "unified diff". This comes from using "diff -u" + instead of simply "diff" when creating your patch. This will + result in quicker acceptance of the patch. +

  • Schema Changes +

    If you make schema changes, you should modify sanitycheck.cgi + to support the new schema. All referential columns should be checked. +

  • Taint Mode +

    All new cgis must run in Taint mode (Perl taint and DBI taint), and existing cgi's + which run in taint mode must not have taint mode turned off. +

  • Templatization +

    Patches to Bugzilla need to support templates so they do not force user interface choices + on Bugzilla administrators. +

  • Variable Names

    If a variable is scoped globally ( 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 blatantly obvious what the variable holds and most likely be shown on the same screen as my $ret = "";.

  • Cross Database Compatability +> Cross Database Compatability

    Bugzilla was originally written to work with MySQL and therefore took advantage +> 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().

  • Cross Platform Compatability +> Cross Platform Compatability

    While Bugzilla was written to be used on Unix based systems (and Unix/Linux is +> 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 -- cgit v1.2.3-24-g4f1b