Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonar read xml file of CppCheck check by MISRA2012;But there is no corresponding misra warning #2587

Open
gaolonglong11 opened this issue Nov 1, 2023 · 13 comments
Labels

Comments

@gaolonglong11
Copy link

cppcheck checks the code using misra rules; The generated xml file; sonar reads xml files; But there is no corresponding misra warning

@guwirth
Copy link
Collaborator

guwirth commented Nov 1, 2023

@guwirth guwirth closed this as completed Nov 18, 2023
@vscodeenv
Copy link

Thank you very much for your reply. I confirm that the XML file generated by cppckeck command contains items that do not conform to MISRA rules, but the format of XML is different from what you said. I would like to ask if there is an xml format conversion tool

@vscodeenv
Copy link

cppcheck --addon="/home/cppcheck/cppcheck-1.90/addons/misra.py" --enable=all --inconclusive --xml-version=2 --platform=unix32 ./user 1>cppcheck-result.xml 2>&1

1121
The above is the result of checking by using cppcheck1.9 command in linux, but this result shows that sonar can not see misra related problems

@guwirth
Copy link
Collaborator

guwirth commented Mar 7, 2024

@guwirth guwirth reopened this Mar 7, 2024
@vscodeenv
Copy link

Thank you for your reply. Here are some screenshots of my Settings
图片1
图片2

@vscodeenv
Copy link

图片3
图片4

@vscodeenv
Copy link

I have checked that the output xml file by cppcheck contains some information about MISRA rules, and sonarqube has also done some Settings through some network tutorials, so I can see some code smells, but there is no corresponding MISR rule conflict prompt, please help me to check whether other places need to be set, thank you very much! Looking forward to your reply!

@vscodeenv
Copy link

I see MISRA rules in the rules created by sonarqube. My sonarqube version is 8.9.10; Plugin-sona-xx-plugin-2.0.7.3119; Gotlab16.3

@vscodeenv
Copy link

图片5

@guwirth
Copy link
Collaborator

guwirth commented Mar 9, 2024

Hi @vscodeenv,

I would start with turning debug info on and than look into the .LOG file.
https://github.com/SonarOpenCommunity/sonar-cxx/wiki/Get-Debug-Information

How to interpret the result is described here:
https://github.com/SonarOpenCommunity/sonar-cxx/wiki/Scan-Report-Files#understanding-the-scanner-log-file

Regards,

@vscodeenv
Copy link

图片2
感谢您的提醒,我在输出里面看到了这个,改了路径以后好像就可以看到违反misra的规则在sonarqube里面

@vscodeenv
Copy link

图片3

@vscodeenv
Copy link

Thanks for your reminding. I saw this in the output. After changing the path, it seems that misra's rules are violated in sonarqube
Please see if there is no problem in this way. Thank you very much! Thank you very much! It's been bothering me for a long time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants