tomaae / homeassistant-openmediavault

OpenMediaVault integration for Home Assistant
Apache License 2.0
109 stars 15 forks source link

Sourcery refactored master branch #75

Closed sourcery-ai[bot] closed 2 years ago

sourcery-ai[bot] commented 2 years ago

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

sourcery-ai[bot] commented 2 years ago

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.26%.

Quality metrics Before After Change
Complexity 14.73 🙂 13.90 🙂 -0.83 👍
Method Length 67.88 🙂 67.17 🙂 -0.71 👍
Working memory 8.99 🙂 9.05 🙂 0.06 👎
Quality 58.65% 🙂 58.91% 🙂 0.26% 👍
Other metrics Before After Change
Lines 1563 1524 -39
Changed files Quality Before Quality After Quality Change
.github/generate_releasenotes.py 60.42% 🙂 59.79% 🙂 -0.63% 👎
custom_components/openmediavault/apiparser.py 49.65% 😞 49.54% 😞 -0.11% 👎
custom_components/openmediavault/binary_sensor.py 72.61% 🙂 73.51% 🙂 0.90% 👍
custom_components/openmediavault/config_flow.py 74.16% 🙂 74.19% 🙂 0.03% 👍
custom_components/openmediavault/diagnostics.py 86.16% ⭐ 87.69% ⭐ 1.53% 👍
custom_components/openmediavault/omv_api.py 50.41% 🙂 50.52% 🙂 0.11% 👍
custom_components/openmediavault/omv_controller.py 63.46% 🙂 63.45% 🙂 -0.01% 👎
custom_components/openmediavault/sensor.py 64.87% 🙂 65.54% 🙂 0.67% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
custom_components/openmediavault/apiparser.py parse_api 34 ⛔ 184 😞 14 😞 27.41% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
custom_components/openmediavault/omv_api.py OpenMediaVaultAPI.query 18 🙂 253 ⛔ 17 ⛔ 28.71% 😞 Try splitting into smaller methods. Extract out complex expressions
custom_components/openmediavault/apiparser.py fill_vals 52 ⛔ 249 ⛔ 8 🙂 29.08% 😞 Refactor to reduce nesting. Try splitting into smaller methods
custom_components/openmediavault/sensor.py update_items 25 😞 195 😞 13 😞 32.42% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
custom_components/openmediavault/omv_api.py OpenMediaVaultAPI.connect 17 🙂 297 ⛔ 12 😞 34.02% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
18.8% 18.8% Duplication