Skip to content

Custom exception class, URL & Key validation using RegEx, typo fixes. #289

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 9 commits into from
Oct 21, 2022

Conversation

rawandahmad698
Copy link
Contributor

@rawandahmad698 rawandahmad698 commented Oct 17, 2022

What kind of change does this PR introduce?

Creates a custom exception class for easier debugging. Fixes some typos, Adds URL & Key validation using RegEx

What is the current behavior?

Currently, Exception and BaseException are thrown, which can make your code prone to errors and difficult to maintain

What is the new behavior?

Adds a custom exception class.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 17, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 1.35 ⭐ 1.99 ⭐ 0.64 👎
Method Length 45.38 ⭐ 45.23 ⭐ -0.15 👍
Working memory 7.67 🙂 7.95 🙂 0.28 👎
Quality 76.00% 74.19% 🙂 -1.81% 👎
Other metrics Before After Change
Lines 273 288 15
Changed files Quality Before Quality After Quality Change
supabase/client.py 69.93% 🙂 67.98% 🙂 -1.95% 👎
supabase/lib/auth_client.py 64.67% 🙂 64.67% 🙂 0.00%
supabase/lib/realtime_client.py 83.67% ⭐ 83.67% ⭐ 0.00%
tests/test_client.py 83.21% ⭐ 83.21% ⭐ 0.00%
tests/test_function_configuration.py 84.14% ⭐ 81.36% ⭐ -2.78% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
supabase/client.py Client.__init__ 6 ⭐ 212 ⛔ 15 😞 43.73% 😞 Try splitting into smaller methods. Extract out complex expressions
supabase/lib/auth_client.py SupabaseAuthClient.__init__ 0 ⭐ 68 🙂 16 ⛔ 64.67% 🙂 Extract out complex expressions

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!

@rawandahmad698 rawandahmad698 changed the title Custom exception class, typo fixes. Custom exception class, URL & Key validation using RegEx, typo fixes. Oct 17, 2022
@mansueli
Copy link
Member

This merge is failing because of the test on:

https://github.com/supabase-community/supabase-py/blob/develop/tests/test_function_configuration.py

Could you rewrite the test there @rawandahmad698, so it passes the test?
It looks really good otherwise.

@rawandahmad698
Copy link
Contributor Author

rawandahmad698 commented Oct 21, 2022 via email

@rawandahmad698
Copy link
Contributor Author

@mansueli Fixed

@J0 J0 self-requested a review October 21, 2022 15:53
@J0
Copy link
Contributor

J0 commented Oct 21, 2022

Hey @rawandahmad698

Thanks for this PR! We're almost at the point we can merge -- seems like the tests are failing as the pre-commit hook (black) hasn't run.

Do you mind running the necessary formatters over the code so that the tests pass?

@rawandahmad698
Copy link
Contributor Author

Hey @rawandahmad698

Thanks for this PR! We're almost at the point we can merge -- seems like the tests are failing as the pre-commit hook (black) hasn't run.

Do you mind running the necessary formatters over the code so that the tests pass?

Could you please clarify? All the tests are OK on my end.

@J0
Copy link
Contributor

J0 commented Oct 21, 2022

So that CI passes* you can take a look at the CI checks for 8244244

You might want to run poetry run pre-commit run --all-files to run the necessary formatting checks

@rawandahmad698
Copy link
Contributor Author

So that CI passes* you can take a look at the CI checks for 8244244

You might want to run poetry run pre-commit run --all-files to run the necessary formatting checks

All good, thank you
trim trailing whitespace.................................................Passed
check for added large files..............................................Passed
fix end of files.........................................................Passed
mixed line ending........................................................Passed
isort....................................................................Passed
autoflake................................................................Passed
black....................................................................Passed
pyupgrade................................................................Passed

@J0
Copy link
Contributor

J0 commented Oct 21, 2022

Hey @rawandahmad698 yup it looks perfect now,

Thanks for your patience with us and we appreciate your effort on this PR!
Do let us know if there's anything else that we can help you with

@J0 J0 merged commit f9b5ac1 into supabase:develop Oct 21, 2022
@rawandahmad698
Copy link
Contributor Author

Appreciate your help, will continue opening PR's :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants