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 #6

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 Oct 16, 2020

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^

@sourcery-ai sourcery-ai bot requested a review from youandvern October 16, 2020 00:24
Comment on lines -25 to +26
if index.isValid():
if role == Qt.DisplayRole:
return str(self._data.iloc[index.row(), index.column()])
if index.isValid() and role == Qt.DisplayRole:
return str(self._data.iloc[index.row(), index.column()])
Copy link
Author

Choose a reason for hiding this comment

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

Function pandasModel.data refactored with the following changes:

  • Merge nested if conditions (merge-nested-ifs)

Comment on lines -171 to +170
for i in range(0, NumberResults):
for i in range(NumberResults):
Copy link
Author

Choose a reason for hiding this comment

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

Function EtabsModel.story_drift_results refactored with the following changes:

  • Replace range(0, x) with range(x) (remove-zero-from-range)

@@ -467,7 +466,6 @@ def saveResults(self):
mess_save = 'ETABS file path not found'

self.statustext.setText(mess_save)
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 get_model_dialog.saveResults refactored with the following changes:

  • Remove redundant pass statement (remove-redundant-pass)

Comment on lines -485 to +483
event.accept() # let the window close
else:
event.accept() # let the window close
event.accept() # let the window close
Copy link
Author

Choose a reason for hiding this comment

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

Function get_model_dialog.closeEvent refactored with the following changes:

  • Hoist repeated code outside conditional statement (hoist-statement-from-if)

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Oct 16, 2020

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 2.22 ⭐ 2.13 ⭐ -0.09 👍
Method Length 79.09 🙂 78.83 🙂 -0.26 👍
Working memory 6.30 🙂 6.30 🙂 0.00
Quality 81.50% 81.63% 0.13% 👍
Other metrics Before After Change
Lines 456 452 -4
Changed files Quality Before Quality After Quality Change
APItest.py 81.50% ⭐ 81.63% ⭐ 0.13% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
APItest.py EtabsModel.story_torsion_check 9 🙂 314 ⛔ 16 ⛔ 34.99% 😞 Try splitting into smaller methods. Extract out complex expressions
APItest.py EtabsModel.__init__ 19 😞 259 ⛔ 10 😞 37.66% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
APItest.py EtabsModel.story_drift_results 3 ⭐ 177 😞 16 ⛔ 48.31% 😞 Try splitting into smaller methods. Extract out complex expressions
APItest.py get_model_dialog.initUI 0 418 ⛔ 10 😞 50.84% 🙂 Try splitting into smaller methods. Extract out complex expressions
APItest.py pandasModel.data 2 ⭐ 34 ⭐ 10 😞 77.09% ⭐ 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.

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