Skip to content

Conversation

@sourcery-ai
Copy link

@sourcery-ai sourcery-ai bot commented Mar 30, 2021

Branch develop refactored by Sourcery.

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

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 develop branch, then run:

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

@sourcery-ai sourcery-ai bot requested a review from maparent March 30, 2021 14:52
Copy link
Author

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Sourcery timed out performing refactorings.

Due to GitHub API limits, only the first 60 comments can be shown.

Install node and npm to a known-good version
"""
node_version = '12.18.2'
npm_version = '6.14.5'
Copy link
Author

Choose a reason for hiding this comment

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

Function separate_pip_install.update_node refactored with the following changes:

Copy link
Member

Choose a reason for hiding this comment

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

variable related to previous variable, refusing.

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Mar 30, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 19.50 😞 19.32 😞 -0.18 👍
Method Length 56.06 ⭐ 55.82 ⭐ -0.24 👍
Working memory 11.83 😞 11.83 😞 0.00
Quality 57.90% 🙂 58.05% 🙂 0.15% 👍
Other metrics Before After Change
Lines 20447 20376 -71
Changed files Quality Before Quality After Quality Change
setup.py 75.97% ⭐ 76.34% ⭐ 0.37% 👍
assembl/fabfile.py 70.23% 🙂 70.25% 🙂 0.02% 👍
assembl/alembic/versions/116f128b0000_locale_as_str.py 52.16% 🙂 52.16% 🙂 0.00%
assembl/alembic/versions/1593228f01ab_hopefully_fix_duplicate_imported_.py 79.71% ⭐ 80.41% ⭐ 0.70% 👍
assembl/alembic/versions/1931a5603650_store_mime_type_of_post_body.py 88.44% ⭐ 88.46% ⭐ 0.02% 👍
assembl/alembic/versions/27f58fce7b77_override_social_autologin.py 44.82% 😞 46.55% 😞 1.73% 👍
assembl/alembic/versions/30365b67b36d_idea_link_creation.py 68.26% 🙂 68.26% 🙂 0.00%
assembl/alembic/versions/33c20d131cb6_fix_notification_constraints.py 68.27% 🙂 86.31% ⭐ 18.04% 👍
assembl/alembic/versions/368a596ab4b5_tombstone_date.py 43.64% 😞 43.64% 😞 0.00%
assembl/alembic/versions/4ea8eee4b157_refactor_subject_body_to_content.py 75.41% ⭐ 75.48% ⭐ 0.07% 👍
assembl/alembic/versions/525b7451056e_migrate_to_social_auth_account.py 55.49% 🙂 55.49% 🙂 0.00%
assembl/alembic/versions/aad68410c38b_langstring_on_announcements.py 43.33% 😞 42.66% 😞 -0.67% 👎
assembl/alembic/versions/ca1c445a2e24_langstring_on_synthesis.py 41.52% 😞 41.08% 😞 -0.44% 👎
assembl/alembic/versions/f7d61062eccf_multi_extracts.py 41.57% 😞 42.30% 😞 0.73% 👍
assembl/auth/util.py 51.62% 🙂 51.47% 🙂 -0.15% 👎
assembl/lib/sqla.py 46.78% 😞 46.82% 😞 0.04% 👍
assembl/lib/text_search.py 36.04% 😞 35.30% 😞 -0.74% 👎
assembl/models/auth.py 64.83% 🙂 64.90% 🙂 0.07% 👍
assembl/models/discussion.py 63.36% 🙂 63.44% 🙂 0.08% 👍
assembl/models/facebook_integration.py 71.28% 🙂 71.54% 🙂 0.26% 👍
assembl/models/idea.py 66.20% 🙂 66.32% 🙂 0.12% 👍
assembl/models/idea_graph_view.py 69.90% 🙂 69.83% 🙂 -0.07% 👎
assembl/models/idea_source.py 64.39% 🙂 66.95% 🙂 2.56% 👍
assembl/models/mail.py 31.88% 😞 31.98% 😞 0.10% 👍
assembl/models/path_utils.py 58.56% 🙂 58.80% 🙂 0.24% 👍
assembl/models/votes.py 68.41% 🙂 68.42% 🙂 0.01% 👍
assembl/models/widgets.py 74.36% 🙂 74.82% 🙂 0.46% 👍
assembl/nlp/init.py 84.73% ⭐ 84.54% ⭐ -0.19% 👎
assembl/nlp/clusters.py 54.89% 🙂 54.87% 🙂 -0.02% 👎
assembl/nlp/optics.py 63.04% 🙂 63.18% 🙂 0.14% 👍
assembl/nlp/translation_service.py 61.05% 🙂 61.98% 🙂 0.93% 👍
assembl/scripts/init.py 87.65% ⭐ 88.13% ⭐ 0.48% 👍
assembl/scripts/clone_discussion.py 32.88% 😞 32.75% 😞 -0.13% 👎
assembl/tasks/init.py 64.59% 🙂 67.25% 🙂 2.66% 👍
assembl/tasks/changes_router.py 65.85% 🙂 66.01% 🙂 0.16% 👍
assembl/tasks/piwik.py 42.65% 😞 41.34% 😞 -1.31% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
assembl/lib/sqla.py BaseOps._do_update_from_json 234 ⛔ 1006 ⛔ 38 ⛔ 0.25% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
assembl/lib/sqla.py BaseOps._do_local_update_from_json 104 ⛔ 882 ⛔ 41 ⛔ 0.29% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
assembl/lib/sqla.py BaseOps.generic_json 191 ⛔ 1136 ⛔ 31 ⛔ 0.75% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
assembl/models/mail.py AbstractMailbox.parse_email 94 ⛔ 713 ⛔ 23 ⛔ 2.91% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
assembl/models/auth.py User.get_notification_subscriptions 65 ⛔ 467 ⛔ 24 ⛔ 4.24% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. 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.

Install node and npm to a known-good version
"""
node_version = '12.18.2'
npm_version = '6.14.5'
Copy link
Member

Choose a reason for hiding this comment

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

variable related to previous variable, refusing.

Comment on lines -776 to -781
post_id = source.sink_post_id
cs = ContentSourceIDs(source=source,
post_id=post_id,
message_id_in_source=fb_post_id)
yield InstanceContext(
inst_ctx['pushed_messages'], cs)
Copy link
Member

Choose a reason for hiding this comment

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

This code is indicative of eventual intent. Stet.

settings_file = join(rootdir, 'local.ini')
if not exists(settings_file):
settings_file = join(rootdir, 'production.ini')
if not exists(settings_file):
Copy link
Member

Choose a reason for hiding this comment

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

This one is so wrong, it's scary.

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.

2 participants