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

Fix crash when station_name not present #117

Closed cgtobi closed 4 years ago

cgtobi commented 4 years ago

Fixes https://github.com/home-assistant/core/issues/40506

sourcery-ai[bot] commented 4 years ago

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.01%.

Quality metrics Before After Change
Complexity 1.12 ⭐ 1.12 ⭐ 0.00
Method Length 52.09 ⭐ 52.23 ⭐ 0.14 👎
Working memory 9.36 🙂 9.37 🙂 0.01 👎
Quality 79.35% 79.34% -0.01% 👎
Other metrics Before After Change
Lines 1943 2012 69
Changed files Quality Before Quality After Quality Change
src/pyatmo/auth.py 78.52% ⭐ 78.52% ⭐ 0.00%
src/pyatmo/weather_station.py 73.25% 🙂 73.39% 🙂 0.14% 👍
tests/test_pyatmo.py 84.56% ⭐ 84.56% ⭐ 0.00%
tests/test_pyatmo_camera.py 83.63% ⭐ 83.63% ⭐ 0.00%
tests/test_pyatmo_thermostat.py 77.81% ⭐ 77.81% ⭐ 0.00%
tests/test_pyatmo_weatherstation.py 75.21% ⭐ 75.08% ⭐ -0.13% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
src/pyatmo/auth.py NetatmoOAuth2.post_request 29 😞 290 ⛔ 16 ⛔ 21.18% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/pyatmo/weather_station.py WeatherStationData.__init__.get_module_names.get_modules.get_monitored_conditions.get_last_data 19 😞 217 ⛔ 12 😞 36.39% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
tests/test_pyatmo_thermostat.py test_home_status_set_thermmode 2 ⭐ 139 😞 26 ⛔ 47.37% 😞 Try splitting into smaller methods. Extract out complex expressions
src/pyatmo/weather_station.py WeatherStationData.__init__ 18 🙂 157 😞 7 🙂 52.38% 🙂 Try splitting into smaller methods
src/pyatmo/weather_station.py WeatherStationData.__init__.get_module_names.get_modules.get_monitored_conditions 11 🙂 126 😞 11 😞 53.13% 🙂 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.