-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat(quality control): ✨ Add MISRA C-2012 compliance #138
base: Version-1.1.0-Development
Are you sure you want to change the base?
Conversation
… environment I have set the `defect_detector` as the default development environment for the duration of this Pull Request.
…eck flag This exposes the unused functions to Cppcheck and will cause my Defect Detector to fail from now, until I re-factor this later on in the Pull Request.
…o Cppcheck source filters This ensures Cppcheck iterates through every C++ source file in CRSF for Arduino's code-base
Cppcheck will iterate through all files in the `examples` directory in addition to all files in the `src` directory
These are the coding rules CRSF for Arduino MUST comply with, in order for my Quality Control CI to pass.
This outlines what version of the MISRA rules are being used and what deviations from the standard rules exist within CRSF for Arduino's code-base.
This contains a disabled `unusedFunction` flag, because I currently want to have any unused functions exposed to both Cppcheck and the MISRA compliance add-on.
…ntrol.ini` configuration file. But leave it disabled, for now.
…rol.ini` configuration file. But leave it disabled, for now.
…ssions.txt` Cppcheck will now iterate across CRSF for Arduino's code-base, and flag it for any coding errors.
Global declaration for now. Missing Includes are currently false positives, because Cppcheck does not know where these files are, yet my compiler does.
Global declaration for now. Unmatched Suppressions here are false positives, because for some reason, Cppcheck is not seeing when a particular suppression is actually working.
Global declaration for now. I am intentionally suppressing all unused functions for the time being, because things like `loop()` and `setup()` appear as false positives, along with CRSF for Arduino's own API appearing as false positives.
… Arduino's entire code-base Cppcheck now checks CRSF for Arduino for compliance with MISRA C 2012 rules in addition to its own checks.
Defects detectedError summaryMultiple low severity level MISRA C:2012 rule violations. Error messageHa! I was expecting that to happen. The fact that there are only low severity MISRA rule violations here is a testament to my own coding practices, to be honest. I was actually expecting moderate to high severity stuff, but nah. Just low stuff... more to do with coding style than anything, which is interesting. There are a handful of other things I need to do before I can write in the |
… Matrix This will be populated with each MISRA C:2012 guideline that CRSF for Arduino is compliant with.
This concludes the addition of missing rules.
This explains what each rule flag means
…d add a section for documenting deviations from the MISRA C guidelines
…icons These emoticons depict where and how this guideline is checked
…ine is checked and where
… for manual review
…eckmarks and crosses This indicates how each guideline is checked
…tly violated rules There are currently 774 MISRA C violations in CRSF for Arduino. The Compliance Matrix now shows manual review of these violated rules until each one can be resolved.
… separate tables, and expand on the information provided.
…ed**, and **Mandatory** flags. This provides a better description of how each flag applies to CRSF for Arduino.
This completes the compliance matrix for CRSF for Arduino
Overview
Note
Currently, this Pull Request is a work-in-progress.
This Pull Request adds compliance with MISRA C:2012 rules, for increased safety and reliability.
Details
CRSF for Arduino's entire C++ code-base is checked for compliance, including all of its example files.
Currently, there are numerous low severity MISRA C:2012 rule violations within the code-base which need to be squared away before CRSF for Arduino can claim compliance.
A "first-look" of what the compliance matrix may look like is available here
To-do list
The following list consists of what needs to be done before this Pull Request can be merged:
Additional
This is the final part of my supply chain hardening in the wake of the XZ Utils back door incident.
While enforcing MISRA C-2012 may not increase security in any significant way, it certainly aims to significantly increase the safety and reliability of CRSF for Arduino, by checking against an internationally recognised rule set of coding standards as outlined by the Motor Industry Software Reliability Association.
I am doing this because #103 completes the full ExpressLRS or TBS Crossfire/Tracer transmitter and receiver control links, where you will be able to fully pipe uplink and downlink data to-and-from your RC project via your own controller handset.
This means I need to ensure my code-base is as reliable as it can possibly be, and bringing in MISRA compliance provides me with the necessary safety and reliability benchmarks that says my code-base does what you tell it to do.