jabesq / netatmo-api-python

Simple API to access Netatmo weather station data from any python script (for Netatmo information, see www.netatmo.com)
MIT License
10 stars 34 forks source link

Reduce thermostat complexity #140

Closed cgtobi closed 3 years ago

sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 5.73 ⭐ 5.06 ⭐ -0.67 👍
Method Length 66.43 🙂 63.12 🙂 -3.31 👍
Working memory 7.47 🙂 7.33 🙂 -0.14 👍
Quality 76.27% 77.24% 0.97% 👍
Other metrics Before After Change
Lines 809 812 3
Changed files Quality Before Quality After Quality Change
src/pyatmo/camera.py 73.35% 🙂 73.35% 🙂 0.00%
src/pyatmo/thermostat.py 81.30% ⭐ 82.99% ⭐ 1.69% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
src/pyatmo/camera.py CameraData.__init__ 34 ⛔ 414 ⛔ 18 ⛔ 14.37% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/pyatmo/camera.py CameraData.__init__.update_events 23 😞 248 ⛔ 9 🙂 37.51% 😞 Refactor to reduce nesting. Try splitting into smaller methods
src/pyatmo/camera.py CameraData.__init__.person_seen_by_camera 18 🙂 130 😞 12 😞 45.10% 😞 Try splitting into smaller methods. Extract out complex expressions
src/pyatmo/camera.py CameraData.__init__.set_state 11 🙂 141 😞 13 😞 48.08% 😞 Try splitting into smaller methods. Extract out complex expressions
src/pyatmo/camera.py CameraData.__init__.update_camera_urls 13 🙂 130 😞 11 😞 50.89% 🙂 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!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

cgtobi commented 3 years ago

Sorry, missed that this overlaps with #139