nasa / fprime-tools

F´ Python tooling and helpers.
https://github.com/nasa/fprime
Apache License 2.0
21 stars 39 forks source link

Inline variables returned immediately #82

Closed ThibFrgsGmz closed 2 years ago

ThibFrgsGmz commented 2 years ago
Originating Project/Creator
Affected Component
Affected Architectures(s)
Related Issue(s) void
Has Unit Tests (y/n) n
Builds Without Errors (y/n) Let CI run
Unit Tests Pass (y/n) Let CI run
Documentation Included (y/n) n

Change Description

The goal of this PR is to inline some variables to a return in case the declared variable is immediately returned.

Rationale

Intermediate variables can be useful if they are used later as a parameter or condition, and their name can provide context for what the variable represents. If returned by a function, the function name is present to indicate the type of result.

I took the liberty of removing these intermediate variables because they don't really add value.

Returning the result directly reduces the mental load of reading the function by shortening the code and removing an unnecessary variable.

Testing/Review Recommendations

void

Future Work

void