Skip to content

Fix #17, consolidate common logic in enable/disable commands #119

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

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

Conversation

thnkslprpt
Copy link
Contributor

Checklist

Describe the contribution

  • Fixes Consolidate similar commands #17
    • Lots of duplicated logic in most of the enable/disable commands. They have been consolidated here to reduce duplication and ease future maintenance.

Testing performed
GitHub CI actions all passing successfully (incl. Build + Run, Unit/Functional Tests etc.).
100% test coverage is maintained.

Expected behavior changes
Behavior is unchanged - the same enable/disable functions exist but call helpers where all common logic is consolidated.

System(s) tested on
Debian 12 using the current main branch of cFS bundle.

Contributor Info
Avi Weiss   @thnkslprpt

/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_DisableAppCmd(const CS_NoArgsCmd_t *CmdPtr)
static void CS_DoEnableDisableAppCmd(const CS_NoArgsCmd_t *CmdPtr, uint16 NewState, uint32 EventID)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_DisableNameAppCmd(const CS_AppNameCmd_t *CmdPtr)
static void CS_DoEnableDisableNameAppCmd(const CS_AppNameCmd_t *CmdPtr, uint16 NewState, uint32 EventID,

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';

if (CS_GetAppResTblEntryByName(&ResultsEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning

This Boolean expression is not side-effect free.

CS_AppData.HkPacket.Payload.CmdCounter++;
if (CS_GetAppDefTblEntryByName(&DefinitionEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning

This Boolean expression is not side-effect free.
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_DisableCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr)
static void CS_DoEnableDisableCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr, uint16 NewState, uint32 EventID)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_EnableEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr)
static void CS_DoEnableDisableEntryIDMemoryCmd(const CS_EntryCmd_t *CmdPtr, uint16 NewState, uint32 EnableEventID,

Check notice

Code scanning / CodeQL

Function too long Note

CS_DoEnableDisableEntryIDMemoryCmd has too many lines (63, while 60 are allowed).
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_DisableTablesCmd(const CS_NoArgsCmd_t *CmdPtr)
static void CS_DoEnableDisableTablesCmd(const CS_NoArgsCmd_t *CmdPtr, uint16 NewState, uint32 EventID)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_DisableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr)
static void CS_DoEnableDisableNameTablesCmd(const CS_TableNameCmd_t *CmdPtr, uint16 NewState, uint32 EventID,

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';

if (CS_GetTableResTblEntryByName(&ResultsEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning

This Boolean expression is not side-effect free.
}

CS_AppData.HkPacket.Payload.CmdCounter++;
if (CS_GetTableDefTblEntryByName(&DefinitionEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning

This Boolean expression is not side-effect free.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate similar commands
1 participant