Commit b929c225 authored by jake%acutex.net's avatar jake%acutex.net

Fix for bug 105365 - Hacker's Guide should be in SGML. This will make it easier…

Fix for bug 105365 - Hacker's Guide should be in SGML. This will make it easier to do other additions to the hacker's guide.
parent 271837ff
...@@ -141,7 +141,7 @@ HREF="gfdl_howto.html" ...@@ -141,7 +141,7 @@ HREF="gfdl_howto.html"
><P ><P
>Version 1.1, March 2000</P >Version 1.1, March 2000</P
><A ><A
NAME="AEN2499" NAME="AEN2550"
></A ></A
><BLOCKQUOTE ><BLOCKQUOTE
CLASS="BLOCKQUOTE" CLASS="BLOCKQUOTE"
......
...@@ -78,7 +78,7 @@ NAME="GFDL_HOWTO" ...@@ -78,7 +78,7 @@ NAME="GFDL_HOWTO"
a copy of the License in the document and put the following a copy of the License in the document and put the following
copyright and license notices just after the title page:</P copyright and license notices just after the title page:</P
><A ><A
NAME="AEN2589" NAME="AEN2640"
></A ></A
><BLOCKQUOTE ><BLOCKQUOTE
CLASS="BLOCKQUOTE" CLASS="BLOCKQUOTE"
......
...@@ -68,7 +68,7 @@ CLASS="GLOSSDIV" ...@@ -68,7 +68,7 @@ CLASS="GLOSSDIV"
><H1 ><H1
CLASS="GLOSSDIV" CLASS="GLOSSDIV"
><A ><A
NAME="AEN2594" NAME="AEN2645"
>0-9, high ascii</A >0-9, high ascii</A
></H1 ></H1
><DL ><DL
...@@ -402,7 +402,7 @@ NAME="GLOSS_P" ...@@ -402,7 +402,7 @@ NAME="GLOSS_P"
><DIV ><DIV
CLASS="EXAMPLE" CLASS="EXAMPLE"
><A ><A
NAME="AEN2685" NAME="AEN2736"
></A ></A
><P ><P
><B ><B
......
...@@ -850,6 +850,20 @@ HREF="quicksearch.html" ...@@ -850,6 +850,20 @@ HREF="quicksearch.html"
HREF="bzhacking.html" HREF="bzhacking.html"
>Hacking Bugzilla</A >Hacking Bugzilla</A
></DT ></DT
><DD
><DL
><DT
>D.5.1. <A
HREF="bzhacking.html#AEN2495"
>Things that have caused problems and should be avoided</A
></DT
><DT
>D.5.2. <A
HREF="bzhacking.html#AEN2509"
>Coding Style for Bugzilla</A
></DT
></DL
></DD
></DL ></DL
></DD ></DD
><DT ><DT
...@@ -1009,7 +1023,7 @@ HREF="setperl.html#AEN2439" ...@@ -1009,7 +1023,7 @@ HREF="setperl.html#AEN2439"
></DT ></DT
><DT ><DT
>1. <A >1. <A
HREF="glossary.html#AEN2685" HREF="glossary.html#AEN2736"
>A Sample Product</A >A Sample Product</A
></DT ></DT
></DL ></DL
......
...@@ -104,6 +104,20 @@ HREF="quicksearch.html" ...@@ -104,6 +104,20 @@ HREF="quicksearch.html"
HREF="bzhacking.html" HREF="bzhacking.html"
>Hacking Bugzilla</A >Hacking Bugzilla</A
></DT ></DT
><DD
><DL
><DT
>D.5.1. <A
HREF="bzhacking.html#AEN2495"
>Things that have caused problems and should be avoided</A
></DT
><DT
>D.5.2. <A
HREF="bzhacking.html#AEN2509"
>Coding Style for Bugzilla</A
></DT
></DL
></DD
></DL ></DL
></DIV ></DIV
><P ><P
......
...@@ -250,100 +250,160 @@ RewriteRule ^/([0-9]+)$ http://foo.bar.com/show_bug.cgi?id=$1 [L,R] ...@@ -250,100 +250,160 @@ RewriteRule ^/([0-9]+)$ http://foo.bar.com/show_bug.cgi?id=$1 [L,R]
<section id="bzhacking"> <section id="bzhacking">
<title>Hacking Bugzilla</title> <title>Hacking Bugzilla</title>
<para> <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. 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.
</para> </para>
<literallayout> <section>
<title>Things that have caused problems and should be avoided</title>
The following is a guide for reviewers when checking code into Bugzilla's <orderedlist>
CVS repostory at mozilla.org. If you wish to submit patches to Bugzilla, <listitem>
you should follow the rules and style conventions below. Any code that <para>
does not adhere to these basic rules will not be added to Bugzilla's Usage of variables in Regular Expressions
codebase. </para>
<para>
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.
It is very important that you don't use a variable in a regular This especially applies when using grep. You should use:
expression unless that variable is supposed to contain an expression. </para>
This especially applies when using grep. You should use: <para>
<programlisting>
grep ($_ eq $value, @array); grep ($_ eq $value, @array);
</programlisting>
- NOT - </para>
<para>
grep (/$value/, @array); -- NOT THIS --
</para>
If you need to use a non-expression variable inside of an expression, be <para>
sure to quote it properly (using \Q..\E). <programlisting>
grep (/$value/, @array);
Coding Style for Bugzilla </programlisting>
------------------------- </para>
<note>
While it's true that not all of the code currently in Bugzilla adheres to <para>
this styleguide, it is something that is being worked toward. Therefore, If you need to use a non-expression variable inside of an expression, be
we ask that all new code (submitted patches and new files) follow this guide sure to quote it properly (using <function>\Q..\E</function>).
as closely as possible (if you're only changing 1 or 2 lines, you don't have </para>
to reformat the entire file :). </note>
</listitem>
1. Whitespace </orderedlist>
</section>
Bugzilla's prefered indentation is 4 spaces (no tabs, please). <section>
<title>Coding Style for Bugzilla</title>
2. Curly braces. <para>
While it's true that not all of the code currently in Bugzilla adheres to
The opening brace of a block should be on the same line as the statement this (or any) styleguide, it is something that is being worked toward. Therefore,
that is causing the block and the closing brace should be at the same we ask that all new code (submitted patches and new files) follow this guide
indentation level as that statement, for example: as closely as possible (if you're only changing 1 or 2 lines, you don't have
to reformat the entire file :).
if ($var) { </para>
print "The variable is true"; <para>
} The Bugzilla development team has decided to adopt the perl style guide as
else { published by Larry Wall. This giude can be found in <quote>Programming
print "Try again"; Perl</quote> (the camel book) or by typing <command>man perlstyle</command> at
} your favorite shell prompt.
</para>
- NOT - <para>
What appears below if a brief summary, please refer to the perl style
if ($var) guide if you don't see your question covered here.
{ </para>
print "The variable is true"; <itemizedlist>
} <listitem>
else <para>
{ Whitespace
print "Try again"; </para>
} <para>
Bugzilla's prefered indentation is 4 spaces (no tabs, please).
3. File Names </para>
</listitem>
File names for bugzilla code and support documention should be legal across <listitem>
multiple platforms. \ / : * ? " < > and | are all illegal characters for <para>
filenames on various platforms. Also, file names should not have spaces in Curly braces.
them as they can cause confusion in CVS and other mozilla.org utilities. </para>
<para>
4. Variable Names 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
If a variable is scoped globally ($::variable) its name should be descriptive indentation level as that statement, for example:
of what it contains. Local variables can be named a bit looser, provided the </para>
context makes their content obvious. For example, $ret could be used as a <para>
staging variable for a routine's return value as the line |return $ret;| will <programlisting>
make it blatently obvious what the variable holds and most likely be shown if ($var) {
on the same screen as |my $ret = "";|. print "The variable is true";
}
5. Cross Database Compatability else {
print "Try again";
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 </programlisting>
should be avoided in all new code. Examples of these features are enums and </para>
encrypt(). <para>
-- NOT THIS --
6. Cross Platform Compatability </para>
<para>
While Bugzilla was written to be used on Unix based systems (and Unix/Linux is <programlisting>
still the only officially supported platform) there are many who desire/need to if ($var)
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 print "The variable is true";
that break Bugzilla's ability to run on multiple operating systems. }
else
</literallayout> {
print "Try again";
}
</programlisting>
</para>
</listitem>
<listitem>
<para>
File Names
</para>
<para>
File names for bugzilla code and support documention should be legal across
multiple platforms. <computeroutput>\ / : * ? &quot; &lt; &gt;</computeroutput>
and <computeroutput>|</computeroutput> 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.
</para>
</listitem>
<listitem>
<para>
Variable Names
</para>
<para>
If a variable is scoped globally (<computeroutput>$::variable</computeroutput>)
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,
<computeroutput>$ret</computeroutput> could be used as a staging variable for a
routine's return value as the line <computeroutput>return $ret;</computeroutput>
will make it blatantly obvious what the variable holds and most likely be shown
on the same screen as <computeroutput>my $ret = "";</computeroutput>.
</para>
</listitem>
<listitem>
<para>
Cross Database Compatability
</para>
<para>
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
<function>encrypt()</function>.
</para>
</listitem>
<listitem>
<para>
Cross Platform Compatability
</para>
<para>
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.
</para>
</listitem>
</itemizedlist>
</section>
</section> </section>
</appendix> </appendix>
......
...@@ -250,100 +250,160 @@ RewriteRule ^/([0-9]+)$ http://foo.bar.com/show_bug.cgi?id=$1 [L,R] ...@@ -250,100 +250,160 @@ RewriteRule ^/([0-9]+)$ http://foo.bar.com/show_bug.cgi?id=$1 [L,R]
<section id="bzhacking"> <section id="bzhacking">
<title>Hacking Bugzilla</title> <title>Hacking Bugzilla</title>
<para> <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. 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.
</para> </para>
<literallayout> <section>
<title>Things that have caused problems and should be avoided</title>
The following is a guide for reviewers when checking code into Bugzilla's <orderedlist>
CVS repostory at mozilla.org. If you wish to submit patches to Bugzilla, <listitem>
you should follow the rules and style conventions below. Any code that <para>
does not adhere to these basic rules will not be added to Bugzilla's Usage of variables in Regular Expressions
codebase. </para>
<para>
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.
It is very important that you don't use a variable in a regular This especially applies when using grep. You should use:
expression unless that variable is supposed to contain an expression. </para>
This especially applies when using grep. You should use: <para>
<programlisting>
grep ($_ eq $value, @array); grep ($_ eq $value, @array);
</programlisting>
- NOT - </para>
<para>
grep (/$value/, @array); -- NOT THIS --
</para>
If you need to use a non-expression variable inside of an expression, be <para>
sure to quote it properly (using \Q..\E). <programlisting>
grep (/$value/, @array);
Coding Style for Bugzilla </programlisting>
------------------------- </para>
<note>
While it's true that not all of the code currently in Bugzilla adheres to <para>
this styleguide, it is something that is being worked toward. Therefore, If you need to use a non-expression variable inside of an expression, be
we ask that all new code (submitted patches and new files) follow this guide sure to quote it properly (using <function>\Q..\E</function>).
as closely as possible (if you're only changing 1 or 2 lines, you don't have </para>
to reformat the entire file :). </note>
</listitem>
1. Whitespace </orderedlist>
</section>
Bugzilla's prefered indentation is 4 spaces (no tabs, please). <section>
<title>Coding Style for Bugzilla</title>
2. Curly braces. <para>
While it's true that not all of the code currently in Bugzilla adheres to
The opening brace of a block should be on the same line as the statement this (or any) styleguide, it is something that is being worked toward. Therefore,
that is causing the block and the closing brace should be at the same we ask that all new code (submitted patches and new files) follow this guide
indentation level as that statement, for example: as closely as possible (if you're only changing 1 or 2 lines, you don't have
to reformat the entire file :).
if ($var) { </para>
print "The variable is true"; <para>
} The Bugzilla development team has decided to adopt the perl style guide as
else { published by Larry Wall. This giude can be found in <quote>Programming
print "Try again"; Perl</quote> (the camel book) or by typing <command>man perlstyle</command> at
} your favorite shell prompt.
</para>
- NOT - <para>
What appears below if a brief summary, please refer to the perl style
if ($var) guide if you don't see your question covered here.
{ </para>
print "The variable is true"; <itemizedlist>
} <listitem>
else <para>
{ Whitespace
print "Try again"; </para>
} <para>
Bugzilla's prefered indentation is 4 spaces (no tabs, please).
3. File Names </para>
</listitem>
File names for bugzilla code and support documention should be legal across <listitem>
multiple platforms. \ / : * ? " < > and | are all illegal characters for <para>
filenames on various platforms. Also, file names should not have spaces in Curly braces.
them as they can cause confusion in CVS and other mozilla.org utilities. </para>
<para>
4. Variable Names 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
If a variable is scoped globally ($::variable) its name should be descriptive indentation level as that statement, for example:
of what it contains. Local variables can be named a bit looser, provided the </para>
context makes their content obvious. For example, $ret could be used as a <para>
staging variable for a routine's return value as the line |return $ret;| will <programlisting>
make it blatently obvious what the variable holds and most likely be shown if ($var) {
on the same screen as |my $ret = "";|. print "The variable is true";
}
5. Cross Database Compatability else {
print "Try again";
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 </programlisting>
should be avoided in all new code. Examples of these features are enums and </para>
encrypt(). <para>
-- NOT THIS --
6. Cross Platform Compatability </para>
<para>
While Bugzilla was written to be used on Unix based systems (and Unix/Linux is <programlisting>
still the only officially supported platform) there are many who desire/need to if ($var)
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 print "The variable is true";
that break Bugzilla's ability to run on multiple operating systems. }
else
</literallayout> {
print "Try again";
}
</programlisting>
</para>
</listitem>
<listitem>
<para>
File Names
</para>
<para>
File names for bugzilla code and support documention should be legal across
multiple platforms. <computeroutput>\ / : * ? &quot; &lt; &gt;</computeroutput>
and <computeroutput>|</computeroutput> 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.
</para>
</listitem>
<listitem>
<para>
Variable Names
</para>
<para>
If a variable is scoped globally (<computeroutput>$::variable</computeroutput>)
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,
<computeroutput>$ret</computeroutput> could be used as a staging variable for a
routine's return value as the line <computeroutput>return $ret;</computeroutput>
will make it blatantly obvious what the variable holds and most likely be shown
on the same screen as <computeroutput>my $ret = "";</computeroutput>.
</para>
</listitem>
<listitem>
<para>
Cross Database Compatability
</para>
<para>
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
<function>encrypt()</function>.
</para>
</listitem>
<listitem>
<para>
Cross Platform Compatability
</para>
<para>
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.
</para>
</listitem>
</itemizedlist>
</section>
</section> </section>
</appendix> </appendix>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment