shosca / django-sorcery

Django Framework integration with SQLAlchemy
https://django-sorcery.readthedocs.io
MIT License
65 stars 6 forks source link

Consolidate package config to pyproject.toml (Sourcery refactored) #183

Open sourcery-ai[bot] opened 2 years ago

sourcery-ai[bot] commented 2 years ago

Pull Request #182 refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

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:

Review changes via command line

To manually merge these changes, make sure you're on the pyproject branch, then run:

git fetch origin sourcery/pyproject
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

sourcery-ai[bot] commented 2 years ago

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 4.78 ⭐ 4.70 ⭐ -0.08 👍
Method Length 61.12 🙂 60.97 ⭐ -0.15 👍
Working memory 6.61 🙂 6.68 🙂 0.07 👎
Quality 74.28% 🙂 74.18% 🙂 -0.10% 👎
Other metrics Before After Change
Lines 5813 5837 24
Changed files Quality Before Quality After Quality Change
django_sorcery/forms.py 54.25% 🙂 54.71% 🙂 0.46% 👍
django_sorcery/shortcuts.py 89.44% ⭐ 89.23% ⭐ -0.21% 👎
django_sorcery/db/fields.py 77.76% ⭐ 78.21% ⭐ 0.45% 👍
django_sorcery/db/models.py 58.36% 🙂 58.36% 🙂 0.00%
django_sorcery/db/profiler.py 82.66% ⭐ 82.98% ⭐ 0.32% 👍
django_sorcery/db/query.py 69.30% 🙂 69.06% 🙂 -0.24% 👎
django_sorcery/db/sqlalchemy.py 76.42% ⭐ 76.42% ⭐ 0.00%
django_sorcery/db/meta/column.py 74.55% 🙂 74.13% 🙂 -0.42% 👎
django_sorcery/db/meta/model.py 57.98% 🙂 57.71% 🙂 -0.27% 👎
django_sorcery/db/meta/relations.py 48.64% 😞 49.53% 😞 0.89% 👍
django_sorcery/formsets/base.py 62.27% 🙂 61.42% 🙂 -0.85% 👎
django_sorcery/formsets/inline.py 72.57% 🙂 70.88% 🙂 -1.69% 👎
django_sorcery/management/alembic.py 68.46% 🙂 68.44% 🙂 -0.02% 👎
django_sorcery/management/base.py 77.04% ⭐ 76.47% ⭐ -0.57% 👎
django_sorcery/validators/init.py 98.50% ⭐ % %
django_sorcery/validators/base.py 79.63% ⭐ 79.89% ⭐ 0.26% 👍
django_sorcery/views/base.py 72.32% 🙂 71.99% 🙂 -0.33% 👎
django_sorcery/views/edit.py 91.55% ⭐ 91.63% ⭐ 0.08% 👍
django_sorcery/views/list.py 80.17% ⭐ 80.14% ⭐ -0.03% 👎
django_sorcery/viewsets/base.py 58.07% 🙂 58.10% 🙂 0.03% 👍
django_sorcery/viewsets/mixins.py 89.07% ⭐ 88.92% ⭐ -0.15% 👎
test_site/polls/views.py 82.69% ⭐ 82.96% ⭐ 0.27% 👍
tests/test_fields.py 81.71% ⭐ 81.89% ⭐ 0.18% 👍
tests/test_forms.py 82.79% ⭐ 81.91% ⭐ -0.88% 👎
tests/formsets/test_base.py 74.99% 🙂 73.50% 🙂 -1.49% 👎
tests/formsets/test_inline.py 84.04% ⭐ 83.24% ⭐ -0.80% 👎
tests/management/commands/test_sorcery_current.py 88.29% ⭐ 88.71% ⭐ 0.42% 👍
tests/management/commands/test_sorcery_downgrade.py 89.04% ⭐ 89.22% ⭐ 0.18% 👍
tests/management/commands/test_sorcery_heads.py 92.73% ⭐ 92.29% ⭐ -0.44% 👎
tests/management/commands/test_sorcery_revision.py 87.90% ⭐ 87.96% ⭐ 0.06% 👍
tests/management/commands/test_sorcery_stamp.py 92.38% ⭐ 92.77% ⭐ 0.39% 👍
tests/management/commands/test_sorcery_upgrade.py 87.92% ⭐ 87.97% ⭐ 0.05% 👍
tests/views/test_detail.py 91.56% ⭐ 91.53% ⭐ -0.03% 👎
tests/views/test_list.py 86.92% ⭐ 87.57% ⭐ 0.65% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
django_sorcery/db/meta/model.py model_info.clean_relation_fields 52 ⛔ 211 ⛔ 13 😞 21.90% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
django_sorcery/db/models.py clone 25 😞 267 ⛔ 14 😞 26.69% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
django_sorcery/db/meta/column.py column_info.__init__ 17 🙂 396 ⛔ 12 😞 31.81% 😞 Try splitting into smaller methods. Extract out complex expressions
django_sorcery/forms.py fields_for_model 18 🙂 170 😞 17 ⛔ 34.51% 😞 Try splitting into smaller methods. Extract out complex expressions
django_sorcery/db/meta/relations.py relation_info.__init__ 7 ⭐ 336 ⛔ 17 ⛔ 35.31% 😞 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!

Help us improve this quality report!