Skip to content

Sourcery refactored master branch#1

Open
sourcery-ai[bot] wants to merge 1 commit into
masterfrom
sourcery/master
Open

Sourcery refactored master branch#1
sourcery-ai[bot] wants to merge 1 commit into
masterfrom
sourcery/master

Conversation

@sourcery-ai

@sourcery-ai sourcery-ai Bot commented Feb 28, 2022

Copy link
Copy Markdown

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

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

Help us improve this pull request!

@sourcery-ai sourcery-ai Bot requested a review from admariner February 28, 2022 00:49
Comment thread scripts/send_metrics.py
Comment on lines -127 to +131
'Authorization': 'Basic ' + base64str(segment_write_key + ':'),
'Authorization': 'Basic ' + base64str(f'{segment_write_key}:'),
'Content-Type': 'application/json',
'User-Agent': 'edx-devstack-send-metrics',
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function send_metrics_to_segment refactored with the following changes:

Comment thread tests/metrics.py
with open(config_path, 'r') as f:
# For debugging...
print("Metrics config file in effect was: " + f.read())
print(f"Metrics config file in effect was: {f.read()}")

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function environment_as refactored with the following changes:

Comment thread tests/metrics.py
# really just serves as documentation of behavior.
p.close()
assert p.exitstatus == None
assert p.exitstatus is None

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function test_handle_ctrl_c refactored with the following changes:

@sourcery-ai

sourcery-ai Bot commented Feb 28, 2022

Copy link
Copy Markdown
Author

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 2.88 ⭐ 2.88 ⭐ 0.00
Method Length 70.93 🙂 71.00 🙂 0.07 👎
Working memory 6.24 🙂 6.24 🙂 0.00
Quality 76.35% 76.34% -0.01% 👎
Other metrics Before After Change
Lines 749 750 1
Changed files Quality Before Quality After Quality Change
scripts/send_metrics.py 66.64% 🙂 66.63% 🙂 -0.01% 👎
tests/metrics.py 84.84% ⭐ 84.83% ⭐ -0.01% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
scripts/send_metrics.py do_opt_in 6 ⭐ 182 😞 11 😞 52.03% 🙂 Try splitting into smaller methods. Extract out complex expressions
scripts/send_metrics.py main 11 🙂 131 😞 9 🙂 56.49% 🙂 Try splitting into smaller methods
scripts/send_metrics.py send_metrics_to_segment 7 ⭐ 124 😞 10 😞 58.99% 🙂 Try splitting into smaller methods. Extract out complex expressions
scripts/send_metrics.py run_wrapped 3 ⭐ 121 😞 8 🙂 67.53% 🙂 Try splitting into smaller methods
tests/metrics.py test_initial_opt_in_accept 0 ⭐ 124 😞 5 ⭐ 77.53% ⭐ Try splitting into smaller methods

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!

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.

0 participants