Example - Integrating Code Analysis

The following example demonstrates how to configure Jenkins to perform code analysis of COBOL projects created with Enterprise Developer.

Example with an Eclipse Project

Before you configure Jenkins, you need to do the following:

  • Ensure Enterprise Developer for Eclipse and Apache Ant are installed on the machine on which code analysis will be performed - see Software Requirements. You use Apache Ant to build and analyze COBOL projects.
  • Configure your COBOL projects for code analysis in Enterprise Developer. See Performing Code Analysis when Building a Project in the IDE for more information.

To integrate code analysis in Jenkins:

  1. Create a freestyle project.
  2. Configure the project to work with COBOL - see Setting up the Environment.
  3. In the Build section of the project's configuration, specify the command that will perform code analysis of your COBOL application:
    call ant -f .cobolBuild build.and.analyze -DanalysisFailOnError=true

    Where .cobolBuild is the Eclipse project file of the application you are going to analyze.

For example, the full set of commands for the Jenkins project might look similar to the following:

rem set the COBOL environment:
call "product-install-dir\SetupEnv.bat"
rem locate the mfant.jar file that includes the definitions of the Micro Focus Ant tasks for analyzing code, and build and analyze the application defined by the .cobolBuild project file:
call ant -lib "%ProgramFiles(x86)%\Micro Focus\Enterprise Developer\bin\mfant.jar" -f .cobolBuild build.and.analyze -DanalysisFailOnError=true 

Where:

  • product-install-dir is the Enterprise Developer installation directory.
Tip:
  • See Performing Code Analysis from the Command Line for all available code analysis options.

  • You can use various plugins to customize the reports from code analysis. For example, you can install the free Log Parser Plugin to provide better formatting of the reports.