Skip to content

Fix nasa#144, removed assignments that are never used as detected by static code analysis - #146

Open
myc-yang wants to merge 1 commit into
nasa:devfrom
myc-yang:144-fix-useless-assignments
Open

myc-yang wants to merge 1 commit into
nasa:devfrom
myc-yang:144-fix-useless-assignments

Conversation

@myc-yang

@myc-yang myc-yang commented Sep 10, 2026

Copy link
Copy Markdown

For members of the cFS Team
Click the Preview tab and select the pull request template corresponding to the type of change you are submitting:

Checklist (Please check before submitting)

Describe the contribution
Fixes #144

Testing performed
Static code analysis and Unit Tests

Expected behavior changes
No impact to behavior

System(s) tested on

  • Hardware: PC
  • OS: Linux

Additional context
Add any other context about the contribution here.

Third party code
If included, identify any third party code and provide text file of license

Contributor Info - All information REQUIRED for consideration of pull request
Michael Yang / NASA/GSFC

@myc-yang
myc-yang requested a review from jphickey September 10, 2026 19:30
@myc-yang
myc-yang force-pushed the 144-fix-useless-assignments branch from f07dac9 to 39dfbb9 Compare September 10, 2026 19:40

@jphickey jphickey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coding standards say we should declare variables at the top of the function, not midway at the time of use.

Just keep all declarations at the beginning with no assignment, and assign later.

Comment thread fsw/src/cs_app.c
CFE_ES_PerfLogEntry(CS_APPMAIN_PERF_ID);

/* Perform application-specific initialization */
Result = CS_AppInit();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove the assignment to CFE_SUCCESS and keep the declaration here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So do you want a one line for a declaration and then a separate line for the assignment?

i.e.
CFE_Status_t Result;

Result = CS_AppInit();

@myc-yang
myc-yang force-pushed the 144-fix-useless-assignments branch from a430de2 to e1239a3 Compare September 14, 2026 17:07
@myc-yang
myc-yang force-pushed the 144-fix-useless-assignments branch from e1239a3 to 0fb7d88 Compare September 16, 2026 11:16
@myc-yang myc-yang changed the title Fix nasa#144, removed assignments that are never used as detected by CodeSonar and/or Axle Fix nasa#144, removed assignments that are never used as detected by static code analysis Sep 16, 2026
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.

CS files make variable assignments that prove to be useless

3 participants