Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Add else condition if API call returns none (Sourcery refactored) #12

Merged
merged 2 commits into from
Apr 7, 2022

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Apr 3, 2022

Pull Request #11 refactored by Sourcery.

Since the original Pull Request was opened as a fork in a contributor's
repository, we are unable to create a Pull Request branching from it.

To incorporate these changes, you can either:

  1. Merge this Pull Request instead of the original, or

  2. Ask your contributor to locally incorporate these commits and push them to
    the original Pull Request

    Incorporate changes via command line
    git fetch https://github.com/vlebourl/custom_vesync pull/11/head
    git merge --ff-only FETCH_HEAD
    git push

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

See our documentation here.

Run Sourcery locally

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

Help us improve this pull request!

borpin and others added 2 commits April 3, 2022 21:53
I was getting exceptions when the API call returned none.
@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Apr 3, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 4.61 ⭐ 4.65 ⭐ 0.04 👎
Method Length 53.33 ⭐ 53.37 ⭐ 0.04 👎
Working memory 6.61 🙂 6.61 🙂 0.00
Quality 74.19% 🙂 74.12% 🙂 -0.07% 👎
Other metrics Before After Change
Lines 1196 1197 1
Changed files Quality Before Quality After Quality Change
custom_components/vesync/pyvesync/vesyncfan.py 74.19% 🙂 74.12% 🙂 -0.07% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
custom_components/vesync/pyvesync/vesyncfan.py VeSyncHumid200300S.get_details 13 🙂 149 😞 10 😞 50.65% 🙂 Try splitting into smaller methods. Extract out complex expressions
custom_components/vesync/pyvesync/vesyncfan.py VeSyncAirBypass.get_details 12 🙂 152 😞 10 😞 51.20% 🙂 Try splitting into smaller methods. Extract out complex expressions
custom_components/vesync/pyvesync/vesyncfan.py VeSyncAir131.change_fan_speed 13 🙂 146 😞 9 🙂 53.03% 🙂 Try splitting into smaller methods
custom_components/vesync/pyvesync/vesyncfan.py VeSyncAirBypass.change_fan_speed 11 🙂 154 😞 9 🙂 53.94% 🙂 Try splitting into smaller methods
custom_components/vesync/pyvesync/vesyncfan.py VeSyncAir131.get_details 3 ⭐ 131 😞 8 🙂 66.32% 🙂 Try splitting into smaller methods

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

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!

@borpin
Copy link
Contributor

borpin commented Apr 3, 2022

Sorry, already had done this it seems 😞

@vlebourl vlebourl merged commit 616f0db into main Apr 7, 2022
@vlebourl vlebourl mentioned this pull request Apr 8, 2022
@vlebourl vlebourl deleted the sourcery/pull-11 branch October 24, 2022 08:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants