]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RuleChecker/CodingConventions.xml
Compatibility with the trunk of root
[u/mrichter/AliRoot.git] / RuleChecker / CodingConventions.xml
CommitLineData
e3d9d369 1<?xml version="1.0" encoding="ISO-8859-1"?>
2<ConventionConfigurations>
3 <ALICEConfig>
4 <ALICECodingRules check = "true">
5 <Rules category = "NamingRules" check = "true">
6 <Rule check = "true">
7 <Name>RN3</Name>
8 <Description>@ No special characters in names are allowed (_,#,$,&amp;,@,-,%).</Description>
9 </Rule>
10 <Rule check = "true">
11 <Name>RN4</Name>
12 <Description>@ Header file names are derived from the
13@ class name and have the suffix ".h" (Classname.h).</Description>
14 </Rule>
15 <Rule check = "true">
16 <Name>RN5</Name>
17 <Description>@ Implementation file names are derived from
18@ the class name and have the suffix ".cxx" (Classname.cxx).</Description>
19 </Rule>
20 <Rule check = "true">
21 <Name>RN6</Name>
22 <Description>@ Class name starts with the prefix "Ali".</Description>
23 </Rule>
24 <Rule check = "true">
25 <Name>RN8</Name>
26 <Description>@ Class names follow the general rule RN3.</Description>
27 </Rule>
28 <Rule check = "true">
29 <Name>RN9</Name>
30 <Description>@ Member function names start with a capital.</Description>
31 </Rule>
32 <Rule check = "true">
33 <Name>RN10</Name>
34 <Description>@ Member function names follow the general rule RN3.</Description>
35 </Rule>
36 <Rule check = "true">
37 <Name>RN11</Name>
38 <Description>@ Data member names start with a prefix "f".</Description>
39 </Rule>
40 <Rule check = "true">
41 <Name>RN12</Name>
42 <Description>@ Data member names follow the general rule RN3.</Description>
43 </Rule>
44 <Rule check = "true">
45 <Name>RN13</Name>
46 <Description>@ Local variables names start with a lower case letter.</Description>
47 </Rule>
48 <Rule check = "true">
49 <Name>RN14</Name>
50 <Description>@ Local variable names follow the general rule RN3.</Description>
51 </Rule>
52 <Rule check = "true">
53 <Name>RN15</Name>
54 <Description>@ Global non-constant, objects names start with a
55@ prefix "gAli". Global constant objects names start
56@ with a prefix "k".</Description>
57 </Rule>
58 <Rule check = "true">
59 <Name>RN16</Name>
60 <Description>@ Global variables names follow the general rule RN3.</Description>
61 </Rule>
62 <Rule check = "true">
63 <Name>RN17</Name>
64 <Description>@ Constants, including names in enumeration
65@ types and constant statics start with a prefix "k".</Description>
66 </Rule>
67 <Rule check = "true">
68 <Name>RN18</Name>
69 <Description>@ Constant names follow the general rule RN3.</Description>
70 </Rule>
71 <Rule check = "true">
72 <Name>RN19</Name>
73 <Description>@ Static data members names start with a prefix "fg",
74@ constant data members names start with a prefix "fk",
75@ static constant data members start with a prefix "fgk".</Description>
76 </Rule>
77 <Rule check = "true">
78 <Name>RN20</Name>
79 <Description>@ Special data member names follow the general rule RN3.</Description>
80 </Rule>
81 </Rules>
82 <Rules category = "CodingRules" check = "true">
83 <Rule check = "true">
84 <Name>RC3</Name>
85 <Description>@ Header files begin and end with multiple-inclusion
86@ protection, as follows:
87@ #ifndef CLASSNAME_H
88@ #define CLASSNAME_H
89@ ....
90@ #endif
91@ where CLASSNAME is constructed from the name of
92@ class by converting all letters to capitals.</Description>
93 </Rule>
94 <Rule check = "true">
95 <Name>RC4</Name>
96 <Description>@ Header files should hold the definition of a single
97@ class. It is possible to define more classes in one
98@ header file only if these classes are embedded.</Description>
99 </Rule>
100 <Rule check = "true">
101 <Name>RC5</Name>
102 <Description>@ Implementation files should hold all the member
103@ function definitions for a single class (or embedded
104@ classes) as defined in the corresponding header file.</Description>
105 </Rule>
106 <Rule check = "true">
107 <Name>RC6</Name>
108 <Description>@ All declarations are declared with friend first
109@ (if there are any), then public, protected and private.</Description>
110 </Rule>
111 <Rule check = "true">
112 <Name>RC7</Name>
113 <Description>@ Usage of global variables should be avoided: they
114@ should be encapsulated in a class. However global
115@ variables pointing to the main object of a package can occur
116@ (e.g. gAlice in AliRoot package).</Description>
117 </Rule>
118 <Rule check = "true">
119 <Name>RC8</Name>
120 <Description>@ The usage of friend classes should be avoided apart
121@ from I/O overloading where it is needed.</Description>
122 </Rule>
123 <Rule check = "true">
124 <Name>RC9</Name>
125 <Description>@ All classes containing at least on virtual function
126@ MUST have a virtual destractor.</Description>
127 </Rule>
128 <Rule check = "true">
129 <Name>RC10</Name>
130 <Description>@ A class that has a member datum with a type which is
131@ a built-in pointer should have a copy constructor and
132@ an assignment operator.</Description>
133 </Rule>
134 <Rule check = "true">
135 <Name>RC11</Name>
136 <Description>@ Make const all member functions that are not supposed
137@ to change member data.</Description>
138 </Rule>
139 <Rule check = "true">
140 <Name>RC12</Name>
141 <Description>@ Dummy argument names in member function declarations
142@ should be always provided, apart from arguments that are not used.</Description>
143 </Rule>
144 <Rule check = "true">
145 <Name>RC14</Name>
146 <Description>@ All class data members should be declared as
147@ "private" or "protected".</Description>
148 </Rule>
149 <Rule check = "true">
150 <Name>RC15</Name>
151 <Description>@ Structures can be used only for accessing FORTRAN
152@ common blocks, functions from external libraries, or internally
153@ within a class. They can have only data members and eventually a
154@ default constructor, member functions are not allowed. Classes
155@ should be used instead in all other cases.</Description>
156 </Rule>
157 <Rule check = "true">
158 <Name>RC16</Name>
159 <Description>@ Using the following words or phrases
160@ is not allowed in output statements.
161@ Segmentation violation
162@ Segmentation fault
163@ Bus error
164@ Abort
165@ Floating point exception
166@ Killed
167@ Busy flag cleared</Description>
168 </Rule>
169 <Rule check = "true">
170 <Name>RC17</Name>
171 <Description>@ Floating point numbers must not be compared
172@ with the "==" or "!=" operators , but with
173@ an appropriate function that calculates
174@ how close the two values are to each other.
175@ If the two numbers are "close enough",
176@ then we call them equal. This rule does
177@ not apply to the variables just after
178@ initialization whose value is not
179@ affected by rounding errors.</Description>
180 </Rule>
181 <Rule check = "true">
182 <Name>RC18</Name>
183 <Description>@ Data members of a class must not be redefined
184@ in derived classes.</Description>
185 </Rule>
186 <Rule check = "true">
187 <Name>RC19</Name>
188 <Description>@ In parameters of a method, objects that are
189@ passed by pointer or by reference and that are not
190@ modified should be declared const.</Description>
191 </Rule>
192 <Rule check = "true">
193 <Name>RC20</Name>
194 <Description>@ Default constructors and constructors which have
195@ TRootIOCtor* as parameter type should not allocate
196@ memory to data members.</Description>
197 </Rule>
198 <Rule check = "true">
199 <Name>RC21</Name>
200 <Description>@ The constant static data members of the basic
201@ types should be initialized in the header file
202@ and static data members in the implementation file.</Description>
203 </Rule>
204 <Rule check = "true">
205 <Name>RC22</Name>
206 <Description>@ The static data members of the object types
207@ should be avoided. A static access function
208@ returning a reference to the local static
209@ variable should be used instead.</Description>
210 </Rule>
211 <Rule check = "true">
212 <Name>RC23</Name>
213 <Description>@ In the destructor, its not necessary to check
214@ if a data member pointer is zero before
215@ deleting it and/or to set it to zero.</Description>
216 </Rule>
217 <Rule check = "true">
218 <Name>RC24</Name>
219 <Description>@ When using math routines, use Root::TMath:: versions.</Description>
220 </Rule>
221 </Rules>
222 <Rules category = "Guidelines" check = "true">
223 <Rule check = "true">
224 <Name>GC1</Name>
225 <Description>@ To be careful especially with using exceptions,
226@ and templates</Description>
227 </Rule>
228 <Rule check = "true">
229 <Name>GC2</Name>
230 <Description>@ When only referring to pointers or references to
231@ types defined in the header file its often not necessary to
232@ include that file. It may be sufficient to use forward declaration.</Description>
233 </Rule>
234 </Rules>
235 <Rules category = "StyleRules" check = "true">
236 <Rule check = "true">
237 <Name>RS1</Name>
238 <Description>@ Each class contains a description of the class
239@ functionality placed at the beginning of the class header
240@ file and an extensive description at the beginning of the
241@class implementation file.</Description>
242 </Rule>
243 <Rule check = "true">
244 <Name>RS2</Name>
245 <Description>@ All data members of a class are described by a short
246@comment following the data member declaration on the same line.</Description>
247 </Rule>
248 <Rule check = "true">
249 <Name>RS3</Name>
250 <Description>@ Member functions comments in implementation files should
251@ be put on the new line after the first "{".</Description>
252 </Rule>
253 <Rule check = "true">
254 <Name>RS4</Name>
255 <Description>@ Header files should not have method body inside the class
256@ definitions in case they do not fit on one or two lines or when the
257@ inline function has unused arguments. The bodies of "inline" functions
258@ should go to the end of the header file after the class definition.</Description>
259 </Rule>
260 <Rule check = "true">
261 <Name>RS5</Name>
262 <Description>@ There is no need to use the keyword "inline" when defining
263@ the body of a function in the class definition.</Description>
264 </Rule>
265 </Rules>
266 </ALICECodingRules>
267 <ForbiddenStrings>
268 <String>Segmentation violation</String>
269 <String>Segmentation fault</String>
270 <String>Bus error</String>
271 <String>Abort</String>
272 <String>Floating point exception</String>
273 <String>Segmentation fault</String>
274 <String>Killed</String>
275 <String>Busy flag cleared</String>
276 </ForbiddenStrings>
277 </ALICEConfig>
278 <ROOTConfig>
279 <ROOTCodingRules check = "true">
280 <Rules category = "NamingRules" check = "true">
281 <Rule check = "true">
282 <Name>RN2</Name>
283 <Description>@ No special characters in names are allowed (_,#,$,&amp;,@,-,%).</Description>
284 </Rule>
285 <Rule check = "true">
286 <Name>RN3</Name>
287 <Description>@ Types begin with a capital letter and end with '_t'.</Description>
288 </Rule>
289 <Rule check = "true">
290 <Name>RN4</Name>
291 <Description>@ Base classes begin with 'T'.</Description>
292 </Rule>
293 <Rule check = "true">
294 <Name>RN6</Name>
295 <Description>@ Enumeration types begin with 'E'.</Description>
296 </Rule>
297 <Rule check = "true">
298 <Name>RN7</Name>
299 <Description>@ Avoid raw C types, we check for the non-portable (memory-wise) types
300@ 'long', 'unsigned long', 'long double', 'bool', 'long long' and
301@ 'unsigned long long'.</Description>
302 </Rule>
303 <Rule check = "true">
304 <Name>RN9</Name>
305 <Description>@ Attributes begin with 'f' and function begin with a capital letter.</Description>
306 </Rule>
307 <Rule check = "true">
308 <Name>RN10</Name>
309 <Description>@ Global static variables begin with 'g'.</Description>
310 </Rule>
311 <Rule check = "true">
312 <Name>RN11</Name>
313 <Description>@ Static data members begin with 'fg'.</Description>
314 </Rule>
315 <Rule check = "true">
316 <Name>RN12</Name>
317 <Description>@ Local variables and parameters begin with a lowercase word.</Description>
318 </Rule>
319 <Rule check = "true">
320 <Name>RN13</Name>
321 <Description>@ Constants begin with 'k', including names of enumeration,
322@ constants and constant statics.</Description>
323 </Rule>
324 </Rules>
325 <Rules category = "StyleRules" check = "true">
326 <Rule check = "true">
327 <Name>RS1</Name>
328 <Description>@ &lt;TAB&gt; used for indentation.</Description>
329 </Rule>
330 <Rule check = "true">
331 <Name>RS2</Name>
332 <Description>@ &lt;SPACE&gt; of 3 should be used for indentation.</Description>
333 </Rule>
334 <Rule check = "true">
335 <Name>RS3</Name>
336 <Description>@ Comments should be written after ClassDef(...,#).</Description>
337 </Rule>
338 <Rule check = "true">
339 <Name>RS4</Name>
340 <Description>@ Member functions' comments should be put on the new line after the first &quot;{&quot;.</Description>
341 </Rule>
342 </Rules>
343 </ROOTCodingRules>
344 </ROOTConfig>
345</ConventionConfigurations>