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

Override (Sourcery refactored) #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Aug 4, 2021

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

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from tfcollins August 4, 2021 23:56
Base automatically changed from override to master August 4, 2021 23:56
Comment on lines -95 to +97
else:
for dec in _contexts:
if dec["hw"] in marker.args[0]:
return dec
for dec in _contexts:
if dec["hw"] in marker.args[0]:
return dec
Copy link
Author

Choose a reason for hiding this comment

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

Function single_ctx_desc refactored with the following changes:

Comment on lines -203 to -212
for hw_ctx_attr in ctx_attrs:
for hw_ctx_attr, value in ctx_attrs.items():
if (
hw_ctx_attr == attr_name
and attr_dict[attr_name]
in ctx_attrs[hw_ctx_attr]
and attr_dict[attr_name] in value
):
found += 1
# Compare other attribute types ...
if attr_type == "dev_attr":
pass
Copy link
Author

Choose a reason for hiding this comment

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

Function lookup_hw_from_map refactored with the following changes:

This removes the following comments ( why? ):

# Compare other attribute types ...

Comment on lines -234 to +229
if request.config.getoption("--skip-scan"):
ctxs = None
else:
ctxs = iio.scan_contexts()
ctxs = None if request.config.getoption("--skip-scan") else iio.scan_contexts()
Copy link
Author

Choose a reason for hiding this comment

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

Function find_contexts refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Aug 4, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 27.68 😞 25.46 😞 -2.22 👍
Method Length 79.50 🙂 79.00 🙂 -0.50 👍
Working memory 9.99 😞 10.18 😞 0.19 👎
Quality 50.36% 🙂 51.05% 🙂 0.69% 👍
Other metrics Before After Change
Lines 245 237 -8
Changed files Quality Before Quality After Quality Change
pytest_libiio/plugin.py 50.36% 🙂 51.05% 🙂 0.69% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
pytest_libiio/plugin.py lookup_hw_from_map 63 ⛔ 177 😞 16 ⛔ 19.45% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
pytest_libiio/plugin.py _contexts 18 🙂 178 😞 10 😞 43.77% 😞 Try splitting into smaller methods. Extract out complex expressions
pytest_libiio/plugin.py find_contexts 8 ⭐ 125 😞 11 😞 56.02% 🙂 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!

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