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

v 1.0 alpha 3 (Sourcery refactored) #205

Closed
wants to merge 1 commit into from
Closed

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Dec 7, 2022

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

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from cleder December 7, 2022 17:23
fastkml/kml.py Outdated
text = self._snippet.get("text")
if text:
if text := self._snippet.get("text"):
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 _Feature.snippet refactored with the following changes:

if self._timespan is None:
return None
return self._timespan.begin[0]
return None if self._timespan is None else self._timespan.begin[0]
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 _AbstractView.begin refactored with the following changes:

if altitude_mode is not None:
self.altitude_mode = altitude_mode.text
else:
if altitude_mode is None:
altitude_mode = element.find(f"{gx.NS}altitudeMode")
self.altitude_mode = altitude_mode.text
self.altitude_mode = altitude_mode.text
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 _AbstractView.from_element refactored with the following changes:

@what-the-diff
Copy link

what-the-diff bot commented Dec 7, 2022

  • In kml.py, the if statement was changed to use a ternary operator
  • In views.py, two lines were removed and one line was added in order to make it more concise

@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Dec 7, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 4.70 ⭐ 4.60 ⭐ -0.10 👍
Method Length 56.33 ⭐ 56.14 ⭐ -0.19 👍
Working memory 7.55 🙂 7.48 🙂 -0.07 👍
Quality 71.30% 🙂 71.57% 🙂 0.27% 👍
Other metrics Before After Change
Lines 449 445 -4
Changed files Quality Before Quality After Quality Change
fastkml/times.py 69.47% 🙂 69.47% 🙂 0.00%
fastkml/views.py 72.15% 🙂 72.56% 🙂 0.41% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
fastkml/views.py _AbstractView.etree_element 11 🙂 260 ⛔ 9 🙂 46.23% 😞 Try splitting into smaller methods
fastkml/times.py _TimePrimitive.parse_str 6 ⭐ 156 😞 12 😞 52.73% 🙂 Try splitting into smaller methods. Extract out complex expressions
fastkml/views.py _AbstractView.from_element 8 ⭐ 234 ⛔ 7 🙂 54.91% 🙂 Try splitting into smaller methods
fastkml/views.py _AbstractView.__init__ 2 ⭐ 102 🙂 13 😞 61.53% 🙂 Extract out complex expressions
fastkml/views.py Camera.__init__ 0 ⭐ 81 🙂 14 😞 65.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!

Help us improve this quality report!

@ghost
Copy link

ghost commented Dec 7, 2022

👇 Click on the image for a new way to code review
  • Make big changes easier — review code in small groups of related files

  • Know where to start — see the whole change at a glance

  • Take a code tour — explore the change with an interactive tour

  • Make comments and review — all fully sync’ed with github

    Try it now!

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

@codecov
Copy link

codecov bot commented Dec 7, 2022

Codecov Report

Base: 92.42% // Head: 92.44% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (bee8bac) compared to base (d7d2939).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #205      +/-   ##
===========================================
+ Coverage    92.42%   92.44%   +0.01%     
===========================================
  Files           23       23              
  Lines         4357     4354       -3     
===========================================
- Hits          4027     4025       -2     
+ Misses         330      329       -1     
Impacted Files Coverage Δ
fastkml/times.py 98.23% <100.00%> (ø)
fastkml/views.py 82.50% <100.00%> (+0.19%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sourcery-ai sourcery-ai bot force-pushed the sourcery/develop branch 2 times, most recently from dd1138a to 4b3b49f Compare December 7, 2022 17:33
@cleder cleder closed this Dec 7, 2022
@cleder cleder deleted the sourcery/develop branch December 7, 2022 20:04
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