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 Starbot ⭐ refactored cleder/fastkml #222

Closed
wants to merge 1 commit into from

Conversation

SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the develop branch, then run:

git fetch https://github.com/sourcery-ai-bot/fastkml develop
git merge --ff-only FETCH_HEAD
git reset HEAD^

if val == "true":
return 1
return int(float(val))
return 1 if val == "true" else int(float(val))
Copy link
Author

Choose a reason for hiding this comment

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

Function PolyStyle.from_element refactored with the following changes:

element = cast(types.Element, config.etree.Element(config.KMLNS + "Base")) # type: ignore[attr-defined]
element = cast(types.Element, config.etree.Element(f"{config.KMLNS}Base"))
Copy link
Author

Choose a reason for hiding this comment

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

Function TestStdLibrary.test_base_from_element_raises refactored with the following changes:

This removes the following comments ( why? ):

# type: ignore[attr-defined]

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 15, 2023

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 3.46 ⭐ 3.44 ⭐ -0.02 👍
Method Length 55.95 ⭐ 55.95 ⭐ 0.00
Working memory 5.94 ⭐ 5.99 ⭐ 0.05 👎
Quality 76.92% 76.97% 0.05% 👍
Other metrics Before After Change
Lines 510 508 -2
Changed files Quality Before Quality After Quality Change
fastkml/styles.py 74.07% 🙂 74.11% 🙂 0.04% 👍
tests/base_test.py 95.45% ⭐ 95.43% ⭐ -0.02% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
fastkml/styles.py StyleMap.from_element 15 🙂 163 😞 9 🙂 49.59% 😞 Try splitting into smaller methods
fastkml/styles.py IconStyle.from_element 6 ⭐ 150 😞 7 🙂 63.60% 🙂 Try splitting into smaller methods
fastkml/styles.py IconStyle.etree_element 4 ⭐ 188 😞 6 ⭐ 64.46% 🙂 Try splitting into smaller methods
fastkml/styles.py BalloonStyle.from_element 7 ⭐ 131 😞 7 🙂 64.76% 🙂 Try splitting into smaller methods
fastkml/styles.py StyleMap.etree_element 4 ⭐ 134 😞 8 🙂 64.98% 🙂 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!

@what-the-diff
Copy link

what-the-diff bot commented Feb 15, 2023

  • The strtobool function in styles.py was changed to return 1 if the value is "true" and 0 otherwise
  • In base_test, a string literal with config.KMLNS + "Base" was replaced by an f-string using config.KMLNS as its variable

@cleder cleder closed this Apr 4, 2023
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.

2 participants