September 9th, 2009
A Task list is the list, that VS generate for your code files including all special marker items like TODO, HACK, etc. Visual studio lists all those items in the tasks window in grid containing the description, file and line number. Clicking an items in the tasks windows cause the editor to jump to this line in the code. Unfortunately, visual studio show only tasks for opened file. Additionally, I thinks the number of task is a metric for code maturity and should be integrated in the continues integration process.
After some googling with both Google and Bing I decided to do it myself. The only similar program I found, was the Task Scanner plug-in from the Hudson project. Unfortunately, this plug-in is written in Java and I didn’t want to assume the presence of a Java runtime on the build server. Besides, I want to integrate this job as build task (MSBuild build for now but maybe also for NAnt, etc..). For all other purposes a command line interface is essential. All those requirements make the amount of code I could reuse very minimal. So I went for the own solution and started summarizing the requirements.
If you prefer the scrum terminology, you can call this wish list the product backlog. It contains all items that COULD be implemented.
Important feature for me are:
Recognizing all lines including // TODO token
Flexibility of defining pre configured and custom tasks
Assigning priorities for the the different types of tasks
Returning for each task a TaskItem object with the description, file and line number.
Grouping the tasks by file name or priority.
Integration with TeamCity
Generating reports in both xml and html formats
being able to define thresholds for the occurrence of the different type/priorities to consider a build failed
To generate a task list to you MSBuild script all you need the the following xml snippet:
<UsingTask AssemblyFile="$(ToolPath)\TasklistGenerator\TasklistGenerator.dll" TaskName="Tasklist" /> <Target Name="tasklist" > <Message Text="==== Generate tas klist ===" /> <CreateItem Include="src\**\*.cs"> <Output TaskParameter="Include" ItemName="Sourcefiles" /> </CreateItem> <Tasklist Files="@(Sourcefiles)" OutputFile="doc\tasks.html" /> </Target>
Currently, still the project in the pre alpha phase of the CTP (PACTP as I call it since two minutes ago). It Uses a Regex to scan all specified cs files and generates a simple xml representation. A html reporting facility is also in pre stone age look and feel html (Did I mention I don’t do UI?) I will try to find out how does usually build tasks, like NUnit, integrate with build server. not sure if there is a common format. The only interface available currently is the MSBuild task.
You can download the most recent source code from GitHub at the following link http://github.com/mouk/Stutali/tree/master.
Because I have never developed an integration task, I don’t know what are the requirements exactly such a thing. More than ever, every idea or notes will be highly appreciated.