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

0.2.0 #5

Merged
merged 11 commits into from
Apr 14, 2022
Merged

0.2.0 #5

merged 11 commits into from
Apr 14, 2022

Conversation

koviubi56
Copy link
Owner

In progress...

Added __repr__ for Request + some reformatting/refactoring
Moved the Server.handle args `clientsocket` and `address` to `request`. `Request` got 2 new attributes: `clientsocket` and `address`. Added some checks for empty requests. Added `Server.make_reply`. `Server.handle` got a new arg: `reply`

`Request` requires `clientsocket` and `address` in `__init__`. `Server._recv_msg` requires the arg `address`. `Server.handle` args are `self, request, reply`.
…it__` was called

In `Server._handle` if there's an Exception while running user-made `Server.handle`, it will reply with an (encrypted, encoded) [UNEXPECTEDERROR]
@koviubi56 koviubi56 self-assigned this Apr 14, 2022
@sourcery-ai sourcery-ai bot mentioned this pull request Apr 14, 2022
koviubi56 and others added 3 commits April 14, 2022 21:00
In `Server._handle` when calling `self.logger.error` the argument `exc_info` was `1`, but now is `True`
Co-authored-by: Sourcery AI <>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Apr 14, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 4.76 ⭐ 5.77 ⭐ 1.01 👎
Method Length 63.96 🙂 63.31 🙂 -0.65 👍
Working memory 7.73 🙂 8.02 🙂 0.29 👎
Quality 67.69% 🙂 65.50% 🙂 -2.19% 👎
Other metrics Before After Change
Lines 594 692 98
Changed files Quality Before Quality After Quality Change
src/p2sn/init.py 65.59% 🙂 63.52% 🙂 -2.07% 👎
tests/test_p2sn.py 94.41% ⭐ 93.68% ⭐ -0.73% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
src/p2sn/init.py Server._handle 18 🙂 191 😞 13 😞 37.48% 😞 Try splitting into smaller methods. Extract out complex expressions
src/p2sn/init.py Server._handle_pubkey 5 ⭐ 227 ⛔ 12 😞 47.97% 😞 Try splitting into smaller methods. Extract out complex expressions
src/p2sn/init.py Client.init 5 ⭐ 291 ⛔ 7 🙂 55.17% 🙂 Try splitting into smaller methods
src/p2sn/init.py Request.__init__ 10 🙂 134 😞 9 🙂 57.04% 🙂 Try splitting into smaller methods
src/p2sn/init.py Server._recv_msg 7 ⭐ 137 😞 9 🙂 59.51% 🙂 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!

@koviubi56 koviubi56 mentioned this pull request Apr 14, 2022
@koviubi56 koviubi56 marked this pull request as ready for review April 14, 2022 19:29
@koviubi56 koviubi56 merged commit c16ba2d into main Apr 14, 2022
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.

1 participant