ITK/Release 4/Modularization/Code Reviews/Checklist: Difference between revisions
From KitwarePublic
< ITK | Release 4 | Modularization | Code Reviews
Jump to navigationJump to search
(Created page with "This page defines the check list to be used by reviewers during the process of reviewing the files in ITKv4. __TOC__") |
No edit summary |
||
Line 2: | Line 2: | ||
__TOC__ | __TOC__ | ||
= Major Topics = | |||
The reviewer will verify the file for compliance with the following major topics | |||
* Coding Style | |||
* Const correctness | |||
* Mini-Pipelines | |||
* Progress Reporting | |||
* Multi-Threading | |||
* Member variables holding to memory | |||
The following sections specify the details to be evaluated with each one of these major topics. | |||
= Coding Style = | |||
Despite the fact that coding style is verified regularly with KStyle, there are still many details that escape that verification. The following list specifies what elements must be verified by the reviewer. | |||
* Filename must match class name | |||
* Files must contain a single class | |||
* Implementation of methods must be in the .txx or .cxx files, not the .h files | |||
* All files must have the [[ITK Copyright Header|Copyright Header]] at the top. | |||
* #define for class name in the .h and .txx files. __classname_h and __classname_txx | |||
* Doxygen documentation | |||
* Brief class doxygen description | |||
* namespace itk | |||
* Complete class doxygen description | |||
* Classes that use SmartPointers must have | |||
** Constructor/Destructor protected | |||
** Copy Constructor : private and not implemented | |||
** Operator= : private and not implemented | |||
* No acronyms in class name or method names | |||
* No unnecessary headers #included | |||
* Justify every public method | |||
* All member variables must be private | |||
* Use Set/Get Macros (macros should call Modified() to ensure pipeline data is updated) | |||
* If deriving from itkObject | |||
** Use New macro | |||
** declare SmartPointer<T> as Pointer | |||
** declare SmartPointer<const T> as ConstPointer | |||
** declare Self | |||
** declare Superclass | |||
** use TypeMacro | |||
** Have PrintSelf() method and print all the member variables | |||
* 100% code coverage (see dashboard) | |||
* Any information that is printed or displayed has to be legible to human eyes | |||
* Respect Coding Style as specified in the document Insight/Documentation/Style.pdf | |||
* Must pass the test of KWStyle | |||
* [Style] In the .txx files of template classes, the first 5 lines in the declaration of methods should be: | |||
** 1) template | |||
** 2) return type | |||
** 3) class name | |||
** 4) ::method name | |||
** 5) the opening bracket | |||
For example: | |||
template < template_arguments > | |||
return_type | |||
classname< template_arguments > | |||
::methodsName( method_arguments ) | |||
{ | |||
// indentation of two spaces | |||
// for the first line of code | |||
int k = 0; | |||
} | |||
In many cases line (2) uses a trait from the templated class and therefore becomes: | |||
typename classname< template_arguments >::trait | |||
== Running KWStyle == | |||
=== In a single file === | |||
KWStyle -xml ITK.kws.xml itkQuadEdgeMeshTest1.cxx -v | |||
=== In all the repository === | |||
make StyleCheck | |||
= Const Correctness = | |||
* All 'non-const' method must justify why they are not 'const' | |||
{{ITK/Template/Footer}} |
Revision as of 21:42, 15 February 2011
This page defines the check list to be used by reviewers during the process of reviewing the files in ITKv4.
Major Topics
The reviewer will verify the file for compliance with the following major topics
- Coding Style
- Const correctness
- Mini-Pipelines
- Progress Reporting
- Multi-Threading
- Member variables holding to memory
The following sections specify the details to be evaluated with each one of these major topics.
Coding Style
Despite the fact that coding style is verified regularly with KStyle, there are still many details that escape that verification. The following list specifies what elements must be verified by the reviewer.
- Filename must match class name
- Files must contain a single class
- Implementation of methods must be in the .txx or .cxx files, not the .h files
- All files must have the Copyright Header at the top.
- #define for class name in the .h and .txx files. __classname_h and __classname_txx
- Doxygen documentation
- Brief class doxygen description
- namespace itk
- Complete class doxygen description
- Classes that use SmartPointers must have
- Constructor/Destructor protected
- Copy Constructor : private and not implemented
- Operator= : private and not implemented
- No acronyms in class name or method names
- No unnecessary headers #included
- Justify every public method
- All member variables must be private
- Use Set/Get Macros (macros should call Modified() to ensure pipeline data is updated)
- If deriving from itkObject
- Use New macro
- declare SmartPointer<T> as Pointer
- declare SmartPointer<const T> as ConstPointer
- declare Self
- declare Superclass
- use TypeMacro
- Have PrintSelf() method and print all the member variables
- 100% code coverage (see dashboard)
- Any information that is printed or displayed has to be legible to human eyes
- Respect Coding Style as specified in the document Insight/Documentation/Style.pdf
- Must pass the test of KWStyle
- [Style] In the .txx files of template classes, the first 5 lines in the declaration of methods should be:
- 1) template
- 2) return type
- 3) class name
- 4) ::method name
- 5) the opening bracket
For example:
template < template_arguments > return_type classname< template_arguments > ::methodsName( method_arguments ) { // indentation of two spaces // for the first line of code int k = 0; }
In many cases line (2) uses a trait from the templated class and therefore becomes:
typename classname< template_arguments >::trait
Running KWStyle
In a single file
KWStyle -xml ITK.kws.xml itkQuadEdgeMeshTest1.cxx -v
In all the repository
make StyleCheck
Const Correctness
- All 'non-const' method must justify why they are not 'const'