Software quality is strongly connected with the source code quality. Coding standards may be very helpful in order to assure the high quality of the code, especially that they are supported by many applications tools. Now we are going to review some tools for checking the .NET source files.
As we are talking about .NET technologies, our first option would be to talk the Visual Studio Team Foundation System, due to its integration with the visual studio IDE and its flexibility managing and tracking the development activities across multiple branches. It allows to set-up a distributed and automated build process that quickly validates that every code check-in maintains product quality before the changes are committed to the sources repository.
Besides we have some other open source options we could use to ensure the code quality, the advantages of this approach are that we have a good cohesion with .NET tools and that we can use those tools for free.
There are different tools to work at any level of the development life cycle, due to our environment configuration we will use a Hudson’s plug-ins to check the code and get reports about the reported issues. Our Hudson environment is going to be configured to achieve the following goals:
- Get the source code from the Subversion repository.
- Build the project using MSBuild.
- Execute FxCop on an assembly and show warnings and a trend graph.
We used Hudson plug-ins in this document.
Once we have downloaded the plug-ins, the next step is to upload the .hpi files to install the plug-ins from outside the central plug in repository from the “Advanced” tab in “Manage Plugins” in the “Manage Hudson” main menu option. Then restart Hudson and the plug-ins are ready be configured and work.
Setting up the Source Code Management
I have created a console solution in visual studio and uploaded it to SourceForge. Hudson supports CVS and SVN out of the box, but there are many other plug-ins we can use. After checking out the files from the repository, Hudson will show the new change sets since the previous build in the Build page. The Changes page contains a detailed view of changes sets such as the developer name, comments and the files that were changed.
To configure we have to access to the “Configure” page located in the project’s main menu.
Under the Source Code Management section, select Subversion option.
- Set the “Repository URL” field, in this example: “https://sourcequality.svn.sourceforge.net/svnroot/sourcequality/HudsonQualityTools/trunk”
- Set the “Local Module Directory” to: “.”.
- Set the repository browser to its default option: “Auto”.
To test that this configuration is correct, save the changes and build the solution. The source code will be downloaded from the repository and then located into the Workspace. Accessing to the “Workspace” page, we can measure that the files had been checked out.