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

Community App Store (Sourcery refactored) #144

Merged
merged 1 commit into from
Feb 4, 2022

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Feb 4, 2022

Pull Request #69 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 app_store branch, then run:

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from Archmonger February 4, 2022 21:06
Comment on lines -39 to +44
for line in map(str.strip, f):
if not line.startswith("#") and not line.startswith("git+"):
requirements.append(line)
requirements.extend(
line
for line in map(str.strip, f)
if not line.startswith("#") and not line.startswith("git+")
)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 39-41 refactored with the following changes:

@@ -5,6 +5,7 @@
https://docs.djangoproject.com/en/dev/ref/settings/
"""

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 430-435 refactored with the following changes:

This removes the following comments ( why? ):

# Performance analysis tools
# API docs generator

if default_tab:
return default_tab

for tabs in tab_groups:
if tabs:
return tabs[0]

return None
return default_tab or next((tabs[0] for tabs in tab_groups if tabs), None)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _default_tab refactored with the following changes:

Comment on lines -11 to +18
for item in search_list:
if item.__contains__(key) and item[key] == value:
return item if return_item else True
return False
return next(
(
item if return_item else True
for item in search_list
if item.__contains__(key) and item[key] == value
),
False,
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function is_key_value_in_iter refactored with the following changes:

  • Use the built-in function next instead of a for-loop (use-next)

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Feb 4, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 20.58 😞 20.73 😞 0.15 👎
Method Length 100.91 🙂 100.36 🙂 -0.55 👍
Working memory 28.41 ⛔ 28.78 ⛔ 0.37 👎
Quality 27.05% 😞 26.19% 😞 -0.86% 👎
Other metrics Before After Change
Lines 493 493 0
Changed files Quality Before Quality After Quality Change
conreq/settings.py 12.63% ⛔ 12.63% ⛔ 0.00%
conreq/utils/generic.py 83.81% ⭐ 84.16% ⭐ 0.35% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
conreq/utils/generic.py clean_string 5 ⭐ 67 🙂 10 😞 68.85% 🙂 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!

@Archmonger Archmonger merged commit c28435a into app_store Feb 4, 2022
@Archmonger Archmonger deleted the sourcery/app_store branch February 4, 2022 21:18
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.

1 participant