Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-12364

Cannot drill down to source code with cppcheck when build source is checked out using SVN

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: cppcheck-plugin
    • Labels:
      None
    • Environment:
      Linux
    • Similar Issues:

      Description

      Using the lastest cppcheck (v1.1). cppcheck is unable to produce linkable references to the source code when Subversion is used to check out the code.

      If you have a project that uses SVN, by default it is checked out into a sub directory under the Jenkins workspace named as the last part of the Subversion URL. This is document in Jenkins in the "If left empty" portion of the optional module local directory:

      "Specify a local directory (relative to the workspace root) where this module is checked out. If left empty, the last path component of the URL is used as the default, just like the svn CLI. A single period (.) may be used to check out the project directly into the workspace rather than into a subdirectory."

      So we have a project with a Subversion URL:

      svn+ssh://svnhost/svnrep/branches/myproj_P2_0_0_cppcheck/myproj

      As a result, our Jenkins workspace becomes:

      /build/workspace/myproj_P2_0_0_cppcheck

      and the source code is checked out in:

      /build/workspace/myproj_P2_0_0_cppcheck/myproj

      cppcheck is run from the Jenkins workspace:

      /build/workspace/myproj_P2_0_0_cppcheck

      and the cppcheck-results.xml file ends up in the Jenkins workspace:

      /build/workspace/myproj_P2_0_0_cppcheck/cppcheck-results.xml

      But, the cppcheck reporter is not using the Jenkins workspace as the root for references in cppcheck-results.xml (/build/workspace/myproj_P2_0_0_cppcheck). The cppcheck reporter is using the SVN check out location to generate the report (/build/workspace/myproj_P2_0_0_cppcheck/myproj).

      Here is an entry from the cppcheck-results.xml file:

      <error file="/myproj/ADI Sharc/Shared/EDFA/deviceClass.c" id="s_tempStorageAssignment" line="34" msg="Implicitly only sto
      rage pObj->pOutVar (type ST_ADC_POINT_T *) not released before assignment: pObj->pOutVar = pOutObj A memory leak h
      as been detected. Only-qualified storage is not released before the last reference to it is lost. (Use -mustfreeonly to
      inhibit warning)" severity="warning"/>

      And the cppcheck plugin generates the following warning:

      [Cppcheck] [WARNING] - The source file 'file:/build/workspace/myproj_P2_0_0_cppcheck/myproj/myproj/ADI%20Sharc/Shared/EDFA/deviceClass.c' doesn't exist on the slave. The ability to display its source code has been removed.

      Note the duplication of the myproj directory. The reporter is not using the Jenkins workspace as the root directory. It is using the SVN check out directory. The report generation should be built relative to the Jenkins workspace, not to the SVN check out directory.

      This should be easy to fix. The reporter should be using the present working directory of the cppcheck-result.xml file as the path to prepend to the file spec from the cppcheck-results.xml file.

      For example, in this case, the reporter start up to examin the cppcheck-results.xml file:

      pwd

      /build/workspace/myproj_P2_0_0_cppcheck

      File in cppcheck-results.xml message:

      file="/myproj/ADI Sharc/Shared/EDFA/deviceClass.c"

      File path is:

      pwd + cppcheck-results.xml file = /build/workspace/myproj_P2_0_0_cppcheck/myproj/ADI Sharc/Shared/EDFA/deviceClass.c

        Attachments

          Activity

            People

            • Assignee:
              gbois Gregory Boissinot
              Reporter:
              c_welch Chris Welch
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: