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 v1.0.x branch #41

Merged
merged 1 commit into from
Nov 5, 2021
Merged

Sourcery refactored v1.0.x branch #41

merged 1 commit into from
Nov 5, 2021

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Nov 5, 2021

Branch v1.0.x 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 v1.0.x branch, then run:

git fetch origin sourcery/v1.0.x
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from willtrnr November 5, 2021 00:28
self._strings = list()
self._strings = []
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function StringTable.__init__ refactored with the following changes:

self._sheets = list()
self._sheets = []
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Workbook.__init__ refactored with the following changes:

return list(v[0] for v in self._sheets)
return [v[0] for v in self._sheets]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Workbook.sheets refactored with the following changes:

rels = dict()
rels = {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Workbook._parse refactored with the following changes:

Comment on lines -19 to +25
if rels_fp is not None:
self._rels = ET.parse(rels_fp).getroot()
else:
self._rels = None
self._rels = ET.parse(rels_fp).getroot() if rels_fp is not None else None
self._stringtable = stringtable
self._data_offset = 0
self.dimension = None
self.cols = list()
self.rels = dict()
self.hyperlinks = dict()
self.cols = []
self.rels = {}
self.hyperlinks = {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Worksheet.__init__ refactored with the following changes:

@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Nov 5, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 7.70 ⭐ 7.69 ⭐ -0.01 👍
Method Length 42.12 ⭐ 41.67 ⭐ -0.45 👍
Working memory 8.90 🙂 8.91 🙂 0.01 👎
Quality 66.68% 🙂 66.79% 🙂 0.11% 👍
Other metrics Before After Change
Lines 181 178 -3
Changed files Quality Before Quality After Quality Change
pyxlsb/stringtable.py 93.82% ⭐ 93.86% ⭐ 0.04% 👍
pyxlsb/workbook.py 68.69% 🙂 68.76% 🙂 0.07% 👍
pyxlsb/worksheet.py 55.98% 🙂 55.81% 🙂 -0.17% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
pyxlsb/worksheet.py Worksheet.rows 25 😞 185 😞 16 ⛔ 29.44% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
pyxlsb/worksheet.py Worksheet._parse 20 😞 126 😞 16 ⛔ 38.75% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
pyxlsb/workbook.py Workbook._parse 7 ⭐ 154 😞 10 😞 55.60% 🙂 Try splitting into smaller methods. Extract out complex expressions
pyxlsb/workbook.py Workbook.get_sheet 5 ⭐ 159 😞 9 🙂 59.09% 🙂 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!

@willtrnr willtrnr merged commit 059a34c into v1.0.x Nov 5, 2021
@willtrnr willtrnr deleted the sourcery/v1.0.x branch November 5, 2021 00:30
@willtrnr willtrnr added this to the v1.0.9 milestone Nov 5, 2021
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.

None yet

1 participant