Fix #2478, Add missing default/break to switch statements#2479
Fix #2478, Add missing default/break to switch statements#2479thnkslprpt wants to merge 1 commit intonasa:mainfrom
default/break to switch statements#2479Conversation
|
I can also add a comment in for each default if it's worthwhile - something like: |
deafult/break to switch statementsdefault/break to switch statements
0f24968 to
b292fe6
Compare
5a464f5 to
a7654a2
Compare
jphickey
left a comment
There was a problem hiding this comment.
Probably should defer this one until we also add coverage tests to get the default cases. Otherwise it makes the missed lines metric go up. (agreed that there is no actual change or new missed code there, it is just now being reported as such)
Some of them might be unreachable, which brings up the question of which of the opposing coding standards we want to violate (i.e. no unreachable lines or having the default case always in the switch)
c9d4a3e to
b775219
Compare
b775219 to
6becb5f
Compare
|
@jphickey in the end it was only 2 problematic cases where the default is unreachable - namely So I rebased this to main and it looks good now. Lots of nice typo fixes as well. |
Checklist
Describe 2the contribution
switchstatements in cFE are missing adefaultand/orbreak#2478switchblocks that were missingdefaultand/orbreakstatements have been correctedTesting performed
GitHub CI actions all passing successfully (incl. Build + Run, Unit/Functional Tests etc.).
Note: Most of the added
defaultcase lines are not tested (impossible to test given that all cases are handled explicitly) so the number of missed lines has grown larger.Expected behavior changes
Effectively no change to current behavior.
Ensuring switch statements are well-formed is good defensive coding for future code changes and improves consistency across cFE.
System(s) tested on
Debian GNU/Linux 11 (bullseye)
Current main branch of cFS bundle.
Contributor Info
Avi Weiss @thnkslprpt