Skip to content
This repository was archived by the owner on Aug 16, 2023. It is now read-only.

Conversation

@sourcery-ai
Copy link

@sourcery-ai sourcery-ai bot commented Jul 15, 2021

Pull Request #8 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/accent-starlette/starlette-core pull/8/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!

@sourcery-ai sourcery-ai bot force-pushed the sourcery/pull-8 branch from a91cc89 to cec4579 Compare July 15, 2021 16:38
Comment on lines -78 to +87
try:
self.connection.quit()
except smtplib.SMTPServerDisconnected:
# This happens when calling quit() on a TLS connection
# sometimes, or when the connection was already disconnected
# by the server.
self.connection.close()
except smtplib.SMTPException:
if self.fail_silently:
return
raise
self.connection.quit()
except smtplib.SMTPServerDisconnected:
# This happens when calling quit() on a TLS connection
# sometimes, or when the connection was already disconnected
# by the server.
self.connection.close()
except smtplib.SMTPException:
if self.fail_silently:
return
raise
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function EmailBackend.close refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Jul 15, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 2.59 ⭐ 2.61 ⭐ 0.02 👎
Method Length 31.84 ⭐ 32.53 ⭐ 0.69 👎
Working memory 5.05 ⭐ 5.13 ⭐ 0.08 👎
Quality 84.34% 84.04% -0.30% 👎
Other metrics Before After Change
Lines 646 659 13
Changed files Quality Before Quality After Quality Change
starlette_core/database.py 82.86% ⭐ 82.86% ⭐ 0.00%
starlette_core/templating.py 83.66% ⭐ 84.16% ⭐ 0.50% 👍
starlette_core/mail/init.py 84.70% ⭐ 84.70% ⭐ 0.00%
starlette_core/mail/backends/console.py 83.09% ⭐ 83.09% ⭐ 0.00%
starlette_core/mail/backends/smtp.py 80.12% ⭐ 79.98% ⭐ -0.14% 👎
tests/test_database.py 86.31% ⭐ 85.85% ⭐ -0.46% 👎
tests/test_messages.py 95.48% ⭐ 93.21% ⭐ -2.27% 👎
tests/test_middleware.py 88.35% ⭐ 86.83% ⭐ -1.52% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
starlette_core/database.py DatabaseURL.replace 15 🙂 178 😞 10 😞 46.14% 😞 Try splitting into smaller methods. Extract out complex expressions
starlette_core/mail/backends/smtp.py EmailBackend.__init__ 6 ⭐ 78 🙂 11 😞 64.32% 🙂 Extract out complex expressions
tests/test_database.py test_declarative_base__can_be_deleted 0 ⭐ 164 😞 6 ⭐ 70.59% 🙂 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!

@codecov-commenter
Copy link

Codecov Report

Merging #9 (cec4579) into master (f5c8795) will decrease coverage by 0.34%.
The diff coverage is 45.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #9      +/-   ##
==========================================
- Coverage   78.19%   77.84%   -0.35%     
==========================================
  Files          14       14              
  Lines         509      510       +1     
==========================================
- Hits          398      397       -1     
- Misses        111      113       +2     
Impacted Files Coverage Δ
starlette_core/database.py 93.95% <ø> (ø)
starlette_core/mail/__init__.py 100.00% <ø> (ø)
starlette_core/mail/backends/console.py 0.00% <ø> (ø)
starlette_core/mail/backends/smtp.py 74.32% <14.28%> (-0.35%) ⬇️
starlette_core/templating.py 82.85% <100.00%> (+1.03%) ⬆️
starlette_core/middleware.py 67.64% <0.00%> (-5.89%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f5c8795...cec4579. Read the comment docs.

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