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

Misc. improvements around tools and deps #134

Closed jabesq 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.35%.

Quality metrics Before After Change
Complexity 2.51 ⭐ 2.22 ⭐ -0.29 👍
Method Length 52.84 ⭐ 51.68 ⭐ -1.16 👍
Working memory 9.53 🙂 9.41 🙂 -0.12 👍
Quality 78.37% 78.72% 0.35% 👍
Other metrics Before After Change
Lines 3115 3171 56
Changed files Quality Before Quality After Quality Change
setup.py 65.95% 🙂 100.00% ⭐ 34.05% 👍
src/version.py 92.88% ⭐
src/pyatmo/main.py 81.93% ⭐ 81.93% ⭐ 0.00%
src/pyatmo/auth.py 76.91% ⭐ 76.91% ⭐ 0.00%
src/pyatmo/camera.py 73.17% 🙂 73.35% 🙂 0.18% 👍
src/pyatmo/thermostat.py 80.71% ⭐ 81.30% ⭐ 0.59% 👍
src/pyatmo/weather_station.py 72.44% 🙂 72.44% 🙂 0.00%
tests/test_pyatmo_camera.py 81.36% ⭐ 81.36% ⭐ 0.00%
tests/test_pyatmo_homecoach.py 83.43% ⭐ 83.43% ⭐ 0.00%
tests/test_pyatmo_publicdata.py 86.64% ⭐ 86.64% ⭐ 0.00%
tests/test_pyatmo_thermostat.py 75.59% ⭐ 75.59% ⭐ 0.00%
tests/test_pyatmo_weatherstation.py 73.41% 🙂 73.41% 🙂 0.00%

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/auth.py NetatmoOAuth2.post_request 29 😞 292 ⛔ 16 ⛔ 21.11% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/pyatmo/thermostat.py HomeData.__init__ 28 😞 243 ⛔ 12 😞 29.15% 😞 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/camera.py CameraData.__init__.update_events 23 😞 248 ⛔ 9 🙂 37.51% 😞 Refactor to reduce nesting. Try splitting into smaller methods

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.