Previous Topic Next topic Print topic


Including Code Analysis in a Continuous Integration Process

There are various way you can integrate code analysis into a continuous integration (CI) framework and a number of plugins that enhance the features. The following examples provide some guidelines on how you can do this:

Example with CruiseControl.NET (CCNet)

The following example provides some guidelines on how to configure CCNet for analyzing COBOL projects created in Visual COBOL for Visual Studio.

You must have a machine that has Visual COBOL for Visual Studio installed, and the machine must be attached to CCNet.

Configure CCNet to run MSBuild build tasks using the MSBuild parameters for code analysis described in Performing Code Analysis from the Command Line. For details, see the documentation of CruiseControl.NET.

Example with Jenkins

The following example provides some guidelines on how to configure Jenkins for analyzing Eclipse COBOL projects. Before you start, you must have a machine that has Visual COBOL for Eclipse installed. The machine must be attached to Jenkins and must have Apache Ant installed.

To integrate code analysis in Jenkins:

  1. Create a Jenkins job for analyzing COBOL projects.
  2. Configure the job that so it runs the following commands from a Windows batch command:
    rem use the following script to set the COBOL environment:
    call "product-install-dir\CreateEnv.bat"
    rem change to the directory on the machine that stores the COBOL sources and the .cobolBuild file:
    cd workspace-dir
    rem set the classpath environment variable:
    set CLASSPATH=product-install-dir\bin\mfant.jar;%CLASSPATH%
    rem perform code analysis using the .cobolBuild script:
    ant -f .cobolBuild build.and.analyze -DanalysisFailOnError=true
  3. Optionally, you can use any suitable plugins for Jenkins to customize things such as the reports from code analysis. For example, you can use the free Log Parser Plugin (available from the Jenkins Web site) to provide better formatting of the reports.
Previous Topic Next topic Print topic