Static Analysis using Jenkins job

Clang scan-build job

Clang is a free open-source cross-platform static analyzer, which comes as a part of so called “LLVM-stack”. Unlike Cppcheck, Clang Static Analyzer is much slower, but it can catch much more critical bugs.

  1. Install a Clang Scan-Build onto the Jenkins master or slave which will be executing your XCode builds.
  2. Install a Clang Scan-Build plugin which will simply archive and make available the analyzer results on the Jenkins server. Go to Manage Jenkins ->Manage Plugins ->install Clang Scan-Build Plugin
  3. Configure the jenkins using JJB(Jenkins Job Builder).It takes simple descriptions of Jenkins jobs in YAML format, and use them to configure Jenkins jobs.
- job:
name: clang-scan
description: Run the clang scan-build on gluster code
project-type: freestyle
scm:
- git:
branches:
- $GERRIT_BRANCH
refspec: $GERRIT_REFSPEC
choosing-strategy: gerrit
url: https://github.com/gluster/glusterfs
properties:
- build-discarder:
days-to-keep: 1
num-to-keep: 1
artifact-days-to-keep: 2
artifact-num-to-keep: 2
triggers:
- timed: “H 0 * * *”
builders:
- shell: !include-raw: ../scripts/clang.sh
publishers:
- scan-build:
mark-unstable: true
threshold: 899
./autogen.sh
./configure CC=clang
scan-build -o ${WORKSPACE}/clangScanBuildReports -v -v — use-cc clang — use-analyzer=/usr/bin/clang make
HTML reports generated after successful build

--

--

Software Engineering Intern at Red Hat

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store