nasa / fprime-tools

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

Refactoring TimeType.compare/__le__ #95

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 purpose of this PR is to:

  1. replace oneif statement with if expression in TimeType.compare
  2. remove unnecessary lambda function in CMakeHandler.purge
  3. remove unnecessary else statement used after return in TimeType.__le__.

Rationale

  1. Code readability
  2. A lambda that calls a function without modifying any of its parameters is unnecessary. It is preferred to use the function cache.get directly as the lambda function calls the same function without any modifications.
  3. In the case of an else block after return, the statements can be shifted out of else to improve code readability.

Testing/Review Recommendations

void

Future Work

void