nasa / fprime

F´ - A flight software and embedded systems framework
https://fprime.jpl.nasa.gov
Apache License 2.0
10.09k stars 1.32k forks source link

Utilize and Statically Analyze JPL Coding Guidelines #1072

Closed Joshua-Anderson closed 1 year ago

Joshua-Anderson commented 3 years ago

Feature Description

JPL's Institutional Coding Standards for C is an institution wide standard for C code. While JPL has no C++ coding standard, many of the C coding standard requirements (no memory allocation outside of initialization, no recursion, etc) can be adapted to C++ projects like F'.

Requirements from the JPL C coding standard requirements that apply to C++ projects should be selected and F' should be audited for requirement compliance.

We should consider using static analysis to audit for and possible enforce compliance with the JPL C coding guidelines.

GitHub has open source CodeQL scripts for most JPL coding standard and power of ten rules available here. We could use these rules with github actions code scanning or custom LGTM analysis scripts. My first glance over the CodeQL scripts revealed that many of them are VxWorks specific and may require refactoring to work with F'

ThibFrgsGmz commented 3 years ago

Very good idea! Particularly since some of your rules make reference to MISRA-C. Some of our quality engineers enjoy "bugging" us to follow MISRA-C (2004) guidelines.

This would reassure the various stakeholders' quality engineers, who may be hesitant if internationally recognized coding rules are not followed.

ThibFrgsGmz commented 2 years ago

I discovered C++ rules on the NASA Technical Reports Server. You don't consider them because they come from another center, are in draft status, and are out of date?

Is the JPL working on writing coding rules for the C++ language?

If so, do you use the MISRA C++ rules, the ESA C++ rules, or the Lockheed Martin JSR AV C++ rules?

LeStarch commented 1 year ago

This is done!