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

Tune-up some method #139

Closed jabesq closed 3 years ago

jabesq commented 3 years ago

Signed-off-by: Hugo Dupras hugo.dupras@nxp.com

cgtobi commented 3 years ago

Looks good to me so far.

sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 4.14 ⭐ 3.60 ⭐ -0.54 👍
Method Length 54.30 ⭐ 49.54 ⭐ -4.76 👍
Working memory 6.42 🙂 6.12 ⭐ -0.30 👍
Quality 81.71% 83.11% 1.40% 👍
Other metrics Before After Change
Lines 1234 1204 -30
Changed files Quality Before Quality After Quality Change
src/pyatmo/camera.py 73.35% 🙂 77.48% ⭐ 4.13% 👍
src/pyatmo/public_data.py 95.70% ⭐ 95.89% ⭐ 0.19% 👍
src/pyatmo/thermostat.py 81.30% ⭐ 82.18% ⭐ 0.88% 👍
src/pyatmo/weather_station.py 72.44% 🙂 72.14% 🙂 -0.30% 👎

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__ 24 😞 314 ⛔ 14 😞 25.60% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/pyatmo/thermostat.py HomeData.__init__ 20 😞 240 ⛔ 12 😞 34.28% 😞 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
src/pyatmo/weather_station.py WeatherStationData.__init__ 20 😞 176 😞 8 🙂 46.75% 😞 Refactor to reduce nesting. Try splitting into smaller methods
src/pyatmo/camera.py CameraData.__init__.set_state 11 🙂 141 😞 13 😞 48.08% 😞 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.