New version (Surafel)
[u/mrichter/AliRoot.git] / RuleChecker / CodingConventions.xml
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>@ The constructors used in Root I/O should not 
195 @ allocate memory to data members. These constructors 
196 @ are either the constructors which have TRootIOCtor* 
197 @ as parameter type, or the default constructors. The 
198 @ rule does not apply to classes excluded from Root 
199 @ I/0 with ClassDef(ClassName,0).</Description>
200                 </Rule>
201                 <Rule check = "false">
202                         <Name>RC21</Name>
203                         <Description>@ The constant static data members of the basic 
204 @ types should be initialized in the header file 
205 @ and static data members in the implementation file.</Description>
206                 </Rule>
207                 <Rule check = "true">
208                         <Name>RC22</Name>
209                         <Description>@ The static data members of the object types 
210 @ should be avoided. A static access function 
211 @ returning a reference to the local static 
212 @ variable should be used instead.</Description>
213                 </Rule>
214                 <Rule check = "true">
215                         <Name>RC23</Name>
216                         <Description>@ In the destructor, its not necessary to check 
217 @ if a data member pointer is zero before 
218 @ deleting it and/or to set it to zero.</Description>
219                 </Rule>
220                 <Rule check = "true">
221                         <Name>RC24</Name>
222                         <Description>@ When using math routines, use Root::TMath:: versions.</Description>
223                 </Rule>
224         </Rules>
225         <Rules category = "Guidelines" check = "true">
226                 <Rule check = "true">
227                         <Name>GC1</Name>
228                         <Description>@ To be careful especially with using exceptions, 
229 @ and templates</Description>
230                 </Rule>
231                 <Rule check = "true">
232                         <Name>GC2</Name>
233                         <Description>@ When only referring to pointers or references to 
234 @ types defined in the header file its often not necessary to 
235 @ include that file. It may be sufficient to use forward declaration.</Description>
236                 </Rule>
237         </Rules>
238         <Rules category = "StyleRules" check = "true">
239                 <Rule check = "true">
240                         <Name>RS1</Name>
241                         <Description>@ Each class contains a description of the class 
242 @ functionality placed at the beginning of the class header 
243 @ file and an extensive description at the beginning of the 
244 @class implementation file.</Description>
245                 </Rule>
246                 <Rule check = "true">
247                         <Name>RS2</Name>
248                         <Description>@ All data members of a class are described by a short 
249 @comment following the data member declaration on the same line.</Description>
250                 </Rule>
251                 <Rule check = "true">
252                         <Name>RS3</Name>
253                         <Description>@ Member functions comments in implementation files should 
254 @ be put on the new line after the first "{".</Description>
255                 </Rule>
256                 <Rule check = "true">
257                         <Name>RS4</Name>
258                         <Description>@ Header files should not have method body inside the class 
259 @ definitions in case they do not fit on one or two lines or when the 
260 @ inline function has unused arguments. The bodies of "inline" functions 
261 @ should go to the end of the header file after the class definition.</Description>
262                 </Rule>
263                 <Rule check = "true">
264                         <Name>RS5</Name>
265                         <Description>@ There is no need to use the keyword "inline" when defining 
266 @ the body of a function in the class definition.</Description>
267                 </Rule>
268         </Rules>
269       </ALICECodingRules>
270       <ForbiddenStrings>
271         <String>Segmentation violation</String>
272         <String>Segmentation fault</String>
273         <String>Bus error</String>
274         <String>Abort</String>
275         <String>Floating point exception</String>
276         <String>Segmentation fault</String>
277         <String>Killed</String>
278         <String>Busy flag cleared</String>
279       </ForbiddenStrings>
280    </ALICEConfig>
281    <ROOTConfig>
282       <ROOTCodingRules check = "true">
283         <Rules category = "NamingRules" check = "true">
284                 <Rule check = "true">
285                         <Name>RN2</Name>
286                         <Description>@ No special characters in names are allowed (_,#,$,&amp;,@,-,%).</Description>
287                 </Rule>
288                 <Rule check = "true">
289                         <Name>RN3</Name>
290                         <Description>@ Types begin with a capital letter and end with '_t'.</Description>
291                 </Rule>
292                 <Rule check = "true">
293                         <Name>RN4</Name>
294                         <Description>@ Base classes begin with 'T'.</Description>
295                 </Rule>
296                 <Rule check = "true">
297                         <Name>RN6</Name>
298                         <Description>@ Enumeration types begin with 'E'.</Description>
299                 </Rule>
300                 <Rule check = "true">
301                         <Name>RN7</Name>
302                         <Description>@ Avoid raw C types, we check for the non-portable (memory-wise) types
303 @ 'long', 'unsigned long', 'long double', 'bool', 'long long' and 
304 @ 'unsigned long long'.</Description>
305                 </Rule>
306                 <Rule check = "true">
307                         <Name>RN9</Name>
308                         <Description>@ Attributes begin with 'f' and function begin with a capital letter.</Description>
309                 </Rule>
310                 <Rule check = "true">
311                         <Name>RN10</Name>
312                         <Description>@ Global static variables begin with 'g'.</Description>
313                 </Rule>
314                 <Rule check = "true">
315                         <Name>RN11</Name>
316                         <Description>@ Static data members begin with 'fg'.</Description>
317                 </Rule>
318                 <Rule check = "true">
319                         <Name>RN12</Name>
320                         <Description>@ Local variables and parameters begin with a lowercase word.</Description>
321                 </Rule>
322                 <Rule check = "true">
323                         <Name>RN13</Name>
324                         <Description>@ Constants begin with 'k', including names of enumeration, 
325 @ constants and constant statics.</Description>
326                 </Rule>
327         </Rules>
328         <Rules category = "StyleRules" check = "true">
329                 <Rule check = "true">
330                         <Name>RS1</Name>
331                         <Description>@ &lt;TAB&gt; used for indentation.</Description>
332                 </Rule>
333                 <Rule check = "true">
334                         <Name>RS2</Name>
335                         <Description>@ &lt;SPACE&gt; of 3 should be used for indentation.</Description>
336                 </Rule>
337                 <Rule check = "true">
338                         <Name>RS3</Name>
339                         <Description>@ Comments should be written after ClassDef(...,#).</Description>
340                 </Rule>
341                 <Rule check = "true">
342                         <Name>RS4</Name>
343                         <Description>@ Member functions' comments should be put on the new line after the first &quot;{&quot;.</Description>
344                 </Rule>
345         </Rules>
346       </ROOTCodingRules>
347    </ROOTConfig>
348 </ConventionConfigurations>