Steps to integrate simian
- add simian to VCS
(in our case folder ./trunk/build/simian) - add build step to your Hudson job
(Execute Windows batch command) - use following two commands
.\trunk\build\Simian\bin\simian-2.2.24.exe
-formatter=xml:.\trunk\bin\Simian.Result.xml
-excludes=**/*.Test/**/*.cs
-excludes=**/*.DbFrame/**/*.cs
-excludes=**/*.DbLayout/**/*.cs
-excludes=**/*.Designer.cs
-excludes=**/XServer1_8.cs
-threshold=10
**/*.cs
EXIT 0
Explanation
For better visibility and understanding i have splitted the first call (simian) over serveral lines. Needless to say that you must contract all parameters and arguments of the simian call in one line.
Parameter –formatter
specifies the output format as well as location and name of the result file
Parameter –excludes
allows exluding specific files
- **/*.Test/**/*.cs
all of our unit test projects names ends with .Test
so this argument excludes all cs-files which are located beneath a folder (inclusive subdirectories!) which name ends with .Test - **/*.DbFrame/**/*.cs and **/*.DbLayout/**/*.cs
do not think about this! – these brownfield projects are so dirty, that code duplication is the smalles problem - **/*.Designer.cs
because the Designer-files offten contains similar constructs they are a typicall candidate for duplicate code lines – this we should not respect - **/XServer1_8.cs
this file contains several auto generated proxy classes for web services – also not interesting for us
Parameter -threshold
sets a threshold how many lines must be duplicated to be considered as a problem for the result file
last Parameter (**/*.cs)
scans all cs-file beneath the current working folder
EXIT command
Especially in brownfield projects you have the situation that programmers copied a lot of code lines. And if simian will find only one the variable %ErrorLevel% is 1 which indicates for Hudson, that something went wrong and you get a red build break.
So it could make sense to return 0 everytime and look sometimes to the Hudson dashboard.