Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update blog project to use published manager #81

Merged
merged 1 commit into from
Sep 23, 2020

Conversation

WayneLambert
Copy link
Owner

Addresses the following:

  • Abstracts the main logic for all views into a model manager removing
    repitition in the blog's views
  • Uses the model manager across the project within the api, blog
    and pages apps
  • Adjusts views and template config to remove all duplicate queries for
    all views
  • Adjusts sitemap.py to account for published model manager
  • Adjusts feeds.py to account for published model manager
  • Check any failing tests and update any requiring logic changes
  • Updates the admin to display id for the models since I use it in
    development and don't necessarily want to open the interpreter or
    DataGrip to see the id/pk all of the time
  • Adjust manage.py to take advantage of Rich's pretty printing in
    development config
  • Tweak Docker config for column width of my screen

Tests Issue Ref: #40
Related Issue: #72
Blog Documentation Update: #15

Addresses the following:

- Abstracts the main logic for all views into a model manager removing
  repitition in the blog's views
- Uses the model manager across the project within the `api`, `blog`
  and `pages` apps
- Adjusts views and template config to remove all duplicate queries for
  all views
- Adjusts `sitemap.py` to account for published model manager
- Adjusts `feeds.py` to account for published model manager
- Check any failing tests and update any requiring logic changes
- Updates the admin to display `id` for the models since I use it in
  development and don't necessarily want to open the interpreter or
  DataGrip to see the id/pk all of the time
- Adjust manage.py to take advantage of Rich's pretty printing in
  development config
- Tweak Docker config for column width of my screen

Tests Issue Ref: #40
Related Issue: #72
Blog Documentation Update: #15
@sourcery-ai
Copy link

sourcery-ai bot commented Sep 23, 2020

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 0.23 ⭐ 0.23 ⭐ 0.00
Method Length 32.54 ⭐ 32.33 ⭐ -0.21 👍
Working memory 4.82 ⭐ 4.78 ⭐ -0.04 👍
Quality 91.89% 92.00% 0.11% 👍
Other metrics Before After Change
Lines 1054 1075 21
Changed files Quality Before Quality After Quality Change
manage.py 68.06% 🙂 64.11% 🙂 -3.95% 👎
aa_project/urls.py 38.97% 😞 38.97% 😞 0.00%
apps/conftest.py 89.98% ⭐ 89.95% ⭐ -0.03% 👎
apps/api/views.py 77.32% ⭐ 85.92% ⭐ 8.60% 👍
apps/api/tests/test_views.py 89.82% ⭐ 89.82% ⭐ 0.00%
apps/blog/admin.py 92.84% ⭐ 92.84% ⭐ 0.00%
apps/blog/feeds.py 97.19% ⭐ 97.84% ⭐ 0.65% 👍
apps/blog/models.py 96.40% ⭐ 96.43% ⭐ 0.03% 👍
apps/blog/sitemap.py 99.08% ⭐ 99.83% ⭐ 0.75% 👍
apps/blog/views.py 91.32% ⭐ 91.49% ⭐ 0.17% 👍
apps/blog/tests/test_views.py 89.19% ⭐ 89.02% ⭐ -0.17% 👎
apps/pages/urls.py 45.22% 😞 45.22% 😞 0.00%
apps/pages/views.py 84.75% ⭐ 88.00% ⭐ 3.25% 👍
apps/pages/tests/test_urls.py 98.95% ⭐ 98.95% ⭐ 0.00%
apps/pages/tests/test_views.py 91.36% ⭐ 90.84% ⭐ -0.52% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
apps/blog/views.py PostDetailView.get_context_data 9 🙂 107 🙂 10 😞 59.27% 🙂 Extract out complex expressions
apps/conftest.py sample_post_data 0 32 ⭐ 17 ⛔ 69.43% 🙂 Extract out complex expressions
apps/blog/models.py Post.save 4 ⭐ 66 🙂 10 😞 69.99% 🙂 Extract out complex expressions
apps/conftest.py sample_user_data 0 32 ⭐ 12 😞 75.78% ⭐ 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!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

@WayneLambert WayneLambert merged commit 7b5d5ac into master Sep 23, 2020
@WayneLambert WayneLambert deleted the add-post-manager branch July 27, 2021 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant