-
Notifications
You must be signed in to change notification settings - Fork 363
Troubleshooting Reports
When setting up the 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 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>
If issues are not displayed, check whether the source file in the report exists on the computer on which the scanner is running.
The scanner always performs an indexing first, where all source files belonging to the plugin are read (see sonar.cxx.file.suffixes). In a second step, the reports are read and the issues are assigned. If a source file or a line does not exist, no issue will be created.
If debug information is enabled during scanning, the following entries are in the .LOG file:
- indexing took place
- sensor was started
- sensor was able to read report
- sensor finished without errors/warnings
TODO update to v2.0
19:09:46.685 DEBUG: Available languages:
19:09:46.685 DEBUG: * CXX (Community) => "cxx"
...
19:09:49.622 DEBUG: Declared extensions of language CXX (Community) were converted to sonar.lang.patterns.c++ : **/*.c,**/*.cpp,**/*.h,**/*.hh,**/*.hpp,**/*.inl
...
19:09:49.636 DEBUG: 'src\example.cpp' indexed with language 'cxx'
...
19:09:51.839 INFO: Sensor C++ (Community) CppCheckSensor [cxx]
19:09:51.839 INFO: Searching reports by relative path with basedir '...' and search prop 'sonar.cxx.cppcheck.reportPaths'
19:09:51.840 DEBUG: Normalized report includes to '[...]'
19:09:51.840 DEBUG: Scanner uses normalized report path(s): '...'
19:09:51.848 INFO: Parser will parse '1' report file(s)
19:09:51.849 INFO: Processing report '...'
19:09:51.849 DEBUG: Parsing 'Cppcheck V2' format
...
19:09:51.878 INFO: CXX-CPPCHECK processed = 48
19:09:51.882 INFO: Sensor C++ (Community) CppCheckSensor [cxx] (done) | time=43ms