Skip to content

Troubleshooting Reports

guwirth edited this page Mar 23, 2021 · 5 revisions

In the SonarQube documentation you will find general information about Analysis Parameters. In addition, the following instructions must be observed.

Invalid Configuration Parameters

If the scanning of a project fails, the .LOG file should be checked first. It is recommended to switch on the debug information. Look for ERROR and WARN entries, these usually already give hints on what needs to be changed in the configuration.

When upgrading to a newer version of the cxx plugin it can happen that the names of configuration parameters have changed. The cxx plugin checks if you are using deprecated configuration parameters and displays corresponding error messages in the .LOG file.

11 WARN CXX property 'sonar.cxx.cppcheck.reportPath' is no longer supported. Use 'sonar.cxx.cppcheck.reportPaths' instead.

Missing Issues

If issues are not displayed:

  • Ensure that the rule is activated in the Quality Profile you are using. Manage Quality Profiles shows you how to do this.
  • Check whether the source file in the report exists on the computer on which the scanner is running. If a source file or a line does not exist, no issue will be created (see 'File Indexing' below).

File Indexing

Make sure that your source files are read (indexed).

The first thing to do is to make sure that the file extensions are mapped correctly (see sonar.cxx.file.suffixes). The entries under Declared extensions list the file extensions assigned to a programming language. Each file extension must be uniquely assigned to one programming language.

17 DEBUG: Declared extensions of language CXX were converted to sonar.lang.patterns.cxx : **/*.cxx,**/*.cpp,**/*.cc,**/*.c,**/*.hxx,**/*.hpp,**/*.hh,**/*.h

The first step in the analysis of a project is always the Indexing files. Here the files are assigned to a programming language on the basis of the file extensions. Files that are not listed here are not displayed in the SonarQube UI. A description of how the files are filtered can be found at Narrowing the Focus.

19 INFO: Indexing files...
20 INFO: Project configuration:
21 DEBUG: 'src/component1.cc' indexed with language 'cxx'
...
24 INFO: 3 files indexed

File Path Issues

When setting up the cxx plugin and build chain, in the beginning the most common problems are file path issues. Using different tools and build chains, differences in operating systems and SonarQube versions do not make things easier. On this page you will find some hints to get your system up and running.

General report file hints

  • Report files are XML, JSON, TXT output files from your tools (e.g. XML output from Cppcheck).

  • For all report files use the native path separator of your operating system for path items. This is backslash (\\) on Microsoft Windows and slash (/) on Linux.

  • Prefer using absolute paths in report files this makes troubleshooting much easier.

  • Relative paths in report files are always relative to the project base directory. Start relative paths always with .\ on Windows or ./ on Linux.

  • The project base directory is normally the directory where you start your analysis and where the sonar-project.properties file is located. With sonar.projectBaseDir you can specify an Alternative analysis directory.

  • Depending on the operating system and SonarQube Database settings paths can be case-sensitive (also on case-insensitive operating systems). Report sensors always try to restore the case-senitive path to avoid problems.

Cppcheck example on Microsoft Windows with an absolute path:

<?xml version="1.0" encoding="UTF-8"?>
<results>
    <error file="C:\root\src\example.cpp" ... />
</results>

Cppcheck example on Microsoft Windows with an relative path. The path is relative to the project base directory:

<?xml version="1.0" encoding="UTF-8"?>
<results>
    <error file=".\src\example.cpp" ... />
</results>
Clone this wiki locally