ros2 / sros2

tools to generate and distribute keys for SROS 2
Apache License 2.0
90 stars 45 forks source link

[FIX] remove dangerous mutable default arguments in generate_artifacts #318

Closed clalancette closed 4 months ago

clalancette commented 4 months ago

You cannot safely use = [] as a default argument in Python; subsequent calls will reuse that object. It probably doesn't matter in this case, as these are all "read-only" arguments, but it is better not to do it at all. Instead, we recognize that this function is always called with all of its arguments, so there is no need for default arguments at all.

While in here, I noticed that, generate_artifacts was returning a boolean on an error path, which is not allowed by its signature. So fix that as well.

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 88.92%. Comparing base (fb22661) to head (b1739fd).

Files Patch % Lines
sros2/sros2/api/_artifact_generation.py 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## rolling #318 +/- ## ======================================== Coverage 88.92% 88.92% ======================================== Files 24 24 Lines 614 614 Branches 64 64 ======================================== Hits 546 546 Misses 50 50 Partials 18 18 ``` | [Flag](https://app.codecov.io/gh/ros2/sros2/pull/318/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ros2) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/ros2/sros2/pull/318/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ros2) | `88.92% <0.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ros2#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

clalancette commented 4 months ago

CI: