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

Sourcery refactored master branch #1

Merged
merged 1 commit into from
Oct 24, 2022
Merged

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Oct 24, 2022

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!

Comment on lines -30 to +34
if not session.get('logged_in'):
return flask.redirect(flask.url_for('.login'))
else:
return flask.redirect(flask.url_for('.dashboard_panel'))
return (
flask.redirect(flask.url_for('.dashboard_panel'))
if session.get('logged_in')
else flask.redirect(flask.url_for('.login'))
)
Copy link
Author

Choose a reason for hiding this comment

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

Function main_page refactored with the following changes:

Comment on lines -101 to +105
if session.get('logged_in') is False:
return flask.redirect(flask.url_for('.main_page'))
else:
if session.get('logged_in') is not False:
session['logged_in'] = False
flask_login.logout_user()
return flask.redirect(flask.url_for('.main_page'))
return flask.redirect(flask.url_for('.main_page'))
Copy link
Author

Choose a reason for hiding this comment

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

Function logout refactored with the following changes:

Comment on lines -127 to +131
return flask.flash('Error: %s' % errorIndication)
return flask.flash(f'Error: {errorIndication}')
elif errorStatus:
return flask.flash(
'%s at %s' % (errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex) - 1] or '?')
f"{errorStatus.prettyPrint()} at {errorIndex and varBinds[int(errorIndex) - 1] or '?'}"
)

Copy link
Author

Choose a reason for hiding this comment

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

Function MainAPI.get refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Oct 24, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 2.46 ⭐ 2.38 ⭐ -0.08 👍
Method Length 60.46 ⭐ 59.69 ⭐ -0.77 👍
Working memory 5.80 ⭐ 6.01 ⭐ 0.21 👎
Quality 78.42% 77.86% -0.56% 👎
Other metrics Before After Change
Lines 116 116 0
Changed files Quality Before Quality After Quality Change
qsnmp.py 78.42% ⭐ 77.86% ⭐ -0.56% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
qsnmp.py MainAPI.get 8 ⭐ 124 😞 9 🙂 60.10% 🙂 Try splitting into smaller methods
qsnmp.py login 3 ⭐ 129 😞 6 ⭐ 71.38% 🙂 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!

@mertcangokgoz mertcangokgoz merged commit e2b3d50 into master Oct 24, 2022
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