PTST / O365-HomeAssistant

Office 365 integration for Home Assistant
MIT License
68 stars 13 forks source link

Feature/configurable scopes (Sourcery refactored) #104

Open sourcery-ai[bot] opened 3 years ago

sourcery-ai[bot] commented 3 years ago

Pull Request #103 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/PTST/O365-HomeAssistant pull/103/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:

sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 6.63 ⭐ 6.62 ⭐ -0.01 👍
Method Length 73.73 🙂 75.61 🙂 1.88 👎
Working memory 18.31 ⛔ 19.23 ⛔ 0.92 👎
Quality 57.91% 🙂 57.22% 🙂 -0.69% 👎
Other metrics Before After Change
Lines 1181 1249 68
Changed files Quality Before Quality After Quality Change
custom_components/o365/init.py 65.74% 🙂 65.67% 🙂 -0.07% 👎
custom_components/o365/calendar.py 71.62% 🙂 70.14% 🙂 -1.48% 👎
custom_components/o365/const.py 33.35% 😞 33.35% 😞 0.00%
custom_components/o365/notify.py 42.89% 😞 42.91% 😞 0.02% 👍
custom_components/o365/sensor.py 52.82% 🙂 52.64% 🙂 -0.18% 👎
custom_components/o365/utils.py 64.57% 🙂 64.92% 🙂 0.35% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
custom_components/o365/notify.py O365EmailService.send_message 23 😞 243 ⛔ 16 ⛔ 26.72% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
custom_components/o365/sensor.py O365QuerySensor.__init__ 28 😞 309 ⛔ 11 😞 28.17% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
custom_components/o365/utils.py add_call_data_to_event 12 🙂 199 😞 12 😞 43.35% 😞 Try splitting into smaller methods. Extract out complex expressions
custom_components/o365/calendar.py setup_platform 10 🙂 185 😞 13 😞 44.69% 😞 Try splitting into smaller methods. Extract out complex expressions
custom_components/o365/init.py setup 10 🙂 148 😞 12 😞 49.79% 😞 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.

saicrazyfire commented 3 years ago

any chance this can be merged in @RogerSelwyn @PTST ?

RogerSelwyn commented 3 years ago

@saicrazyfire - I'm afraid I've only done the minimum to it in my dorkrecently to ensure to keeps working. The code you've submitted I'm sure is fine, but I imagine @PTST would need to validate it before he would wish to merge. I'm afraid it is beyond my knowledge or time available to do that validation (I only minimally use the calendar) so wouldn't want to merge into my fork.

saicrazyfire commented 3 years ago

Sorry for the confusion, I didn't create the PR. I'm just someone who is really looking forward to this feature :)