edgehog-device-manager / edgehog-device-runtime

Edgehog Device Runtime is a portable middleware written in Rust, that enables remote device management on Linux-based systems.
Apache License 2.0
12 stars 10 forks source link

Refactor: clean up the code and fix all clippy lints #220

Closed joshuachp closed 1 year ago

joshuachp commented 1 year ago

This PR shouldn't make any logic change, but is aimed to fix all clippy lints.

The OTA struct was renamed to Ota to conform to the Rust naming convention, since it was a lint. The other Ota* structs where not changed to keep the changes to a minimum, although I think they should be updated to be more idiomatic.

This PR also fixes some telemetry tests which would fail if run twice consecutively:

To fix them, we introduced a developer dependency tempdir to create a temporary directory to store the telemetry registries.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 68.42% and project coverage change: +1.33 :tada:

Comparison is base (d704384) 70.11% compared to head (af1108c) 71.44%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #220 +/- ## ========================================== + Coverage 70.11% 71.44% +1.33% ========================================== Files 22 22 Lines 813 809 -4 ========================================== + Hits 570 578 +8 + Misses 243 231 -12 ``` | [Impacted Files](https://codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager) | Coverage Δ | | |---|---|---| | [src/ota/rauc.rs](https://codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL290YS9yYXVjLnJz) | `12.24% <0.00%> (ø)` | | | [src/telemetry/net\_if\_properties.rs](https://codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL3RlbGVtZXRyeS9uZXRfaWZfcHJvcGVydGllcy5ycw==) | `56.81% <ø> (ø)` | | | [src/telemetry/mod.rs](https://codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL3RlbGVtZXRyeS9tb2QucnM=) | `82.96% <71.42%> (-4.45%)` | :arrow_down: | | [src/ota/ota\_handler.rs](https://codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL290YS9vdGFfaGFuZGxlci5ycw==) | `88.18% <80.00%> (+2.36%)` | :arrow_up: | | [src/data/astarte.rs](https://codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL2RhdGEvYXN0YXJ0ZS5ycw==) | `68.62% <100.00%> (+3.92%)` | :arrow_up: | | [src/led\_behavior.rs](https://codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL2xlZF9iZWhhdmlvci5ycw==) | `100.00% <100.00%> (+3.33%)` | :arrow_up: | | [src/repository/file\_state\_repository.rs](https://codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL3JlcG9zaXRvcnkvZmlsZV9zdGF0ZV9yZXBvc2l0b3J5LnJz) | `100.00% <100.00%> (ø)` | | | [src/telemetry/base\_image.rs](https://codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL3RlbGVtZXRyeS9iYXNlX2ltYWdlLnJz) | `94.73% <100.00%> (-0.51%)` | :arrow_down: | | [src/telemetry/battery\_status.rs](https://codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL3RlbGVtZXRyeS9iYXR0ZXJ5X3N0YXR1cy5ycw==) | `56.41% <100.00%> (ø)` | | | [src/telemetry/wifi\_scan.rs](https://codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/220?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager#diff-c3JjL3RlbGVtZXRyeS93aWZpX3NjYW4ucnM=) | `76.92% <100.00%> (ø)` | | ... and [1 file with indirect coverage changes](https://codecov.io/gh/edgehog-device-manager/edgehog-device-runtime/pull/220/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager) Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=edgehog-device-manager)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.