MongoEngine / flask-mongoengine

MongoEngine flask extension with WTF model forms support
Other
840 stars 256 forks source link

New model form generator: Support of DictField #510

Closed insspb closed 2 years ago

sourcery-ai[bot] commented 2 years ago

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.73%.

Quality metrics Before After Change
Complexity 1.10 ⭐ 0.84 ⭐ -0.26 👍
Method Length 53.40 ⭐ 52.74 ⭐ -0.66 👍
Working memory 6.15 ⭐ 6.03 ⭐ -0.12 👍
Quality 80.81% 81.54% 0.73% 👍
Other metrics Before After Change
Lines 2534 2629 95
Changed files Quality Before Quality After Quality Change
example_app/app.py 46.75% 😞 44.42% 😞 -2.33% 👎
example_app/boolean_demo.py 70.63% 🙂 88.03% ⭐ 17.40% 👍
example_app/dates_demo.py 67.56% 🙂 77.71% ⭐ 10.15% 👍
example_app/numbers_demo.py 69.93% 🙂 83.54% ⭐ 13.61% 👍
example_app/strings_demo.py 68.51% 🙂 80.54% ⭐ 12.03% 👍
example_app/views.py 77.05% ⭐ 75.49% ⭐ -1.56% 👎
flask_mongoengine/db_fields.py 83.96% ⭐ 84.13% ⭐ 0.17% 👍
flask_mongoengine/wtf/fields.py 81.36% ⭐ 80.22% ⭐ -1.14% 👎
tests/test_db_fields.py 84.58% ⭐ 84.58% ⭐ 0.00%
tests/test_forms_v2.py 76.60% ⭐ 78.01% ⭐ 1.41% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
flask_mongoengine/db_fields.py StringField.__init__ 6 ⭐ 111 🙂 14 😞 54.98% 🙂 Extract out complex expressions
flask_mongoengine/db_fields.py WtfFieldMixin.__init__ 5 ⭐ 131 😞 12 😞 56.45% 🙂 Try splitting into smaller methods. Extract out complex expressions
flask_mongoengine/wtf/fields.py MongoDictField.__init__ 6 ⭐ 120 😞 11 😞 58.55% 🙂 Try splitting into smaller methods. Extract out complex expressions
tests/test_forms_v2.py test__full_document_form__does_not_create_any_unexpected_data_in_database 0 ⭐ 461 ⛔ 6 ⭐ 59.54% 🙂 Try splitting into smaller methods
tests/test_db_fields.py TestNumberFieldCommons.test__init__method__set_number_range_validator__if_range_given 0 ⭐ 105 🙂 11 😞 66.43% 🙂 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!