Вставьте отчет о чистоте лукавства в SonarQube

Во-первых, извините за мой английский.

Я работаю с унаследованным кодом C, созданным с помощью CVI 6.0, и изучаю различные инструменты проверки и отчетности, такие как Cppcheck, Clang-Tidy и CCCC.

Я использую sonarqube со сканером сонара с плагином сообщества C sonar-c-plugin-0.9.8.

Это дерево проекта:

C:\Source\directory\project\project_directory
│   window1.h       <-- Copy of the uir.h to generate documentation
│   window1.uir     <-- This is a user interface generated with CVI
│   window1_uir.h   <-- File generated automatically with CVI. Do not edit.
│   window2.h
│   window2.uir
│   window2_uir.h
│       
└───Src
    │   include_file1.h
    │   include_file2.h
    │   
    ├───Module1
    │   │   Module1.c
    │   │   Module1.h
    │   │   
    │   └───Component1
    │           Component1.c
    │           Component1.h
    │           
    ├───Module2
    │       Module2.c
    │       Module2.h
    │       
    └───Module3
            Module3.c
            Module3.h

В папке проекта дерево содержит следующие файлы:

C:\Source\directory\project
│       
├───reports
│   clang-tidy-report
│   cppcheck-report.xml
│   
├───Docs
│   DoxyGen Documents
│   
├───project-cppcheck-build-dir
│       file1.a1
│       
├───CVI_includes
│       includefile1.h
│       includefile2.h
│       includefile3.h
│       
└───project_directory
        project_sonarrunner.bat
        clang_tidy_generator.bat
        project.cppcheck

Когда я использую Clang-tidy с этим форматом, я должен определить и включить все элементы, которые я использую в проекте, в одной командной строке. Файл clang_tidy_generator.bat содержит:

clang-tidy -checks='cert-*,google-*,llvm-*,misc-*,performance-*,readility-*,-clang-analyzer-cplusplus.*' -enable-check-profile project\src\Module1\Module1.c project\src\Module1\Component1\Component1.c project\src\Module2\Module2.c project\src\Module3\Module3.c -- -I..\CVI_includes -Iproject\src -Iproject\src\Module1 -Iproject\src\Module1\Component1 -Iproject\src\Module2 -Iproject\src\Module3 -D_CVI_ -DWIN32 -D_NI_mswin32_ -D_WIN32 >..\reports\clang-tidy-report

cppcheck отлично выводит файл cppcheck-report.xml, и clang-tidy также правильно генерирует файл.

Project_sonarrunner.bat содержит:

c:\path\to\sonar-scanner.bat -Dsonar.projectKey=project -Dsonar.sources=. -Dsonar.host.url=http://localhost:9000 -Dsonar.c.includeDirectories=..\CVI_includes,.\,.\src,.\src\Module1,.\src\Module1\Component1,.\src\Module2,.\src\Module3, -Dsonar.c.defines=_CVI_,WIN32,_NI_mswin32_,_WIN32 -Dsonar.c.cppcheck.reportPath=..\reports\cppcheck-report.xml -Dsonar.c.clangtidy.reportPath=..\reports\clang-tidy-report -Dsonar.login=XXXXXXX

Sonarqube правильно выводит данные, проанализированные из XML-файла, но clang-tidy - нет, показывая некоторые ошибки.

Часть вывода отчета при выполнении project_sonarrunner.bat выглядит следующим образом:

INFO: Searching coverage reports by path with basedir 'C:\Source\directory\project\project_directory' and search prop 'sonar.c.coverage.reportPath'
INFO: Searching for coverage reports '[]'
INFO: Coverage BaseDir 'C:\Source\directory\project\project_directory'
INFO: Sensor c SquidSensor [c] (done) | time=3154ms
INFO: Sensor c RatsSensor [c]
INFO: Searching reports by relative path with basedir 'C:\Source\directory\project\project_directory' and search prop 'sonar.c.rats.reportPath'
INFO: Undefined report path value for key 'sonar.c.rats.reportPath'
INFO: C-RATS processed = 0
INFO: Sensor c RatsSensor [c] (done) | time=6ms
INFO: Sensor c CppCheckSensor [c]
INFO: Searching reports by relative path with basedir 'C:\Source\directory\project\project_directory' and search prop 'sonar.c.cppcheck.reportPath'
INFO: Scanner found '1' report files
INFO: Parser will parse '1' report files
INFO: Processing report 'C:\Source\directory\project\reports\cppcheck-report.xml'
WARN: Cannot find the file 'C:\Source\directory\project\CVI_includes\includefile1.h', skipping violations
INFO: Added report 'C:\Source\directory\project\reports\cppcheck-report.xml' (parsed by: CppcheckParserV2)
INFO: C-CPPCHECK processed = 520
INFO: Sensor c CppCheckSensor [c] (done) | time=750ms
INFO: Sensor c PCLintSensor [c]
INFO: Searching reports by relative path with basedir 'C:\Source\directory\project\project_directory' and search prop 'sonar.c.pclint.reportPath'
INFO: Undefined report path value for key 'sonar.c.pclint.reportPath'
INFO: C-PC-LINT processed = 0
INFO: Sensor c PCLintSensor [c] (done) | time=3ms
INFO: Sensor c DrMemorySensor [c]
INFO: Searching reports by relative path with basedir 'C:\Source\directory\project\project_directory' and search prop 'sonar.c.drmemory.reportPath'
INFO: Undefined report path value for key 'sonar.c.drmemory.reportPath'
INFO: C-DRMEMORY processed = 0
INFO: Sensor c DrMemorySensor [c] (done) | time=4ms
INFO: Sensor c CompilerSensor [c]
INFO: Searching reports by relative path with basedir 'C:\Source\directory\project\project_directory' and search prop 'sonar.c.compiler.reportPath'
INFO: Undefined report path value for key 'sonar.c.compiler.reportPath'
INFO: C-COMPILER processed = 0
INFO: Sensor c CompilerSensor [c] (done) | time=2ms
INFO: Sensor c VeraxxSensor [c]
INFO: Searching reports by relative path with basedir 'C:\Source\directory\project\project_directory' and search prop 'sonar.c.vera.reportPath'
INFO: Undefined report path value for key 'sonar.c.vera.reportPath'
INFO: C-VERA++ processed = 0
INFO: Sensor c VeraxxSensor [c] (done) | time=1ms
INFO: Sensor c ValgrindSensor [c]
INFO: Searching reports by relative path with basedir 'C:\Source\directory\project\project_directory' and search prop 'sonar.c.valgrind.reportPath'
INFO: Undefined report path value for key 'sonar.c.valgrind.reportPath'
INFO: C-VALGRIND processed = 0
INFO: Sensor c ValgrindSensor [c] (done) | time=1ms
INFO: Sensor c ClangTidySensor [c]
INFO: Searching reports by relative path with basedir 'C:\Source\directory\project\project_directory' and search prop 'sonar.c.clangtidy.reportPath'
INFO: Scanner found '1' report files
INFO: Parser will parse '1' report files
INFO: Processing report 'C:\Source\directory\project\reports\clang-tidy-report'
ERROR: Could not add the issue 'The rule 'ClangTidy-c:google-readability-braces-around-statements' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-invalid-source-encoding' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-parentheses' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-format' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-cast-calling-convention' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-format' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-parentheses' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-pointer-sign' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-invalid-source-encoding' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-pointer-sign' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-invalid-source-encoding' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:performance-type-promotion-in-math-fn' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:google-readability-braces-around-statements' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-constant-conversion' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:performance-type-promotion-in-math-fn' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:google-readability-braces-around-statements' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-constant-conversion' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-nonportable-include-path' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:google-readability-braces-around-statements' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-nonportable-include-path' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-shift-op-parentheses' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:google-readability-braces-around-statements' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:performance-type-promotion-in-math-fn' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-format' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-unused-value' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-implicit-int' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-pointer-sign' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:google-readability-braces-around-statements' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-tautological-pointer-compare' does not exist.', skipping issue
ERROR: Could not add the issue 'The rule 'ClangTidy-c:clang-diagnostic-tautological-pointer-compare' does not exist.', skipping issue
INFO: C-CLANG-TIDY processed = 385
INFO: Sensor c ClangTidySensor [c] (done) | time=105ms
INFO: Sensor c ClangSASensor [c]
INFO: Searching reports by relative path with basedir 'C:\Source\directory\project\project_directory' and search prop 'sonar.c.clangsa.reportPath'
INFO: Undefined report path value for key 'sonar.c.clangsa.reportPath'
INFO: C-CLANGSA processed = 0
INFO: Sensor c ClangSASensor [c] (done) | time=3ms
INFO: Sensor c ExternalRulesSensor [c]
INFO: Undefined report path value for key 'sonar.c.other.xslt.1.inputs'
ERROR: sonar.c.other.xslt.1.stylesheet is not defined.
INFO: Searching reports by relative path with basedir 'C:\Source\directory\project\project_directory' and search prop 'sonar.c.other.reportPath'
INFO: Undefined report path value for key 'sonar.c.other.reportPath'
INFO: C-OTHER processed = 0
INFO: Sensor c ExternalRulesSensor [c] (done) | time=3ms
INFO: Sensor c XunitSensor [c]
INFO: Undefined report path value for key 'sonar.c.xunit.reportPath'
INFO: Sensor c XunitSensor [c] (done) | time=0ms
INFO: Sensor Unit Test Results Import [c]
INFO: Sensor Unit Test Results Import [c] (done) | time=0ms
INFO: Sensor c CoverageSensor [c]
INFO: Sensor c CoverageSensor [c] (done) | time=0ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=98ms
INFO: Sensor CPD Block Indexer
INFO: Sensor CPD Block Indexer (done) | time=1ms
INFO: No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
INFO: 9 files had no CPD blocks
INFO: Calculating CPD for 1 file
INFO: CPD calculation finished
INFO: Analysis report generated in 249ms, dir size=610 KB
INFO: Analysis reports compressed in 59ms, zip size=140 KB
INFO: Analysis report uploaded in 27ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/project
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=XXXXXX
INFO: Task total time: 7.542 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 9.183s
INFO: Final Memory: 58M/533M
INFO: ------------------------------------------------------------------------

Есть мои вопросы:

Код не вставлен правильно, и мой подозреваемый -Dsonar.sources=. Как правильно вставить файлы?

Как проанализировать код в sonarqube? Код не анализируется с помощью плагина Sonar C Community.

Как вставить отчет clang-tidy в SonarQube?

Заранее спасибо и хорошего дня.

0 ответов

Другие вопросы по тегам