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

Added small subset of MISRA C++:2008 rules that can be checked using clang-tidy #17034

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PetervdPerk-NXP
Copy link
Member

This is to keep the discussion going that @Igor-Misic started this week, I was thinking we should first try to utilize free OSS to implement some basic MISRA rules checking, before considering commercial tooling.

This patch adds the make misra-basic target, that tests some Misra rules using clang-tidy.

This can be extended by CppCheck as well, however CppCheck can't check on rule basis but generates an complete overview. But it's addons module does implement a nice set of Misra C rules see https://github.com/danmar/cppcheck/blob/main/addons/misra.py

@mrpollo
Copy link
Contributor

mrpollo commented Mar 5, 2021

Thanks for the push on this end @PetervdPerk-NXP great work!

Should we add a check on CI?

@mrpollo mrpollo added this to In progress in High-Priority Queue via automation Mar 5, 2021
@PetervdPerk-NXP
Copy link
Member Author

Hm I think if we add this to the CI it will trigger a lot of errors.

I would rather use this target as a staging area of rules that can be reviewed and later a review should take place to decide which rules should be integrated into the .clang-tidy file which are used in the CI already.

Like @dagar showcased here https://github.com/PX4/PX4-Autopilot/runs/2029824398 the CI already runs make clang-tidy-quiet

@mrpollo
Copy link
Contributor

mrpollo commented Apr 28, 2021

@PetervdPerk-NXP hey I think it's best if you integrate this into the current clang-tidy CI build, and close this PR, what do you think?

@mrpollo mrpollo moved this from In progress to Waiting for Author in High-Priority Queue Apr 28, 2021
@PetervdPerk-NXP
Copy link
Member Author

This will trigger a lot of errors though, would that be a problem for the clang-tidy CI?
Furthermore should this be enforce on code styling/formatting already? @Igor-Misic is it already decided PX4 is going to follow the MISRA coding standard and which version then?

@Igor-Misic
Copy link
Member

Igor-Misic commented Apr 29, 2021

@Igor-Misic is it already decided PX4 is going to follow the MISRA coding standard and which version then?

Nothing decided yet. At the dev call where this was topic was discussed it will probably never be fully adopted, but maybe just subsets. I am happy if people just keep this topic in mind.

I've seen many different coding styles here so far so not sure what would be next to god step. Maybe to do fork and rewrite everything xD

@junwoo091400 junwoo091400 added Development Environment 🖥️ For setting up environment for developers. VSCode Extensions, WSL configuration, etc Discussion (needed) 💬 labels Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development Environment 🖥️ For setting up environment for developers. VSCode Extensions, WSL configuration, etc Discussion (needed) 💬
Projects
No open projects
High-Priority Queue
Waiting for Author
Development

Successfully merging this pull request may close these issues.

None yet

4 participants