fastkml icon indicating copy to clipboard operation
fastkml copied to clipboard

Add type annotations

Open cleder opened this issue 4 years ago β€’ 4 comments

cleder avatar Dec 21 '21 21:12 cleder

Codecov Report

Merging #154 (177935e) into develop (79d635c) will increase coverage by 0.46%. The diff coverage is 98.68%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #154      +/-   ##
===========================================
+ Coverage    97.41%   97.87%   +0.46%     
===========================================
  Files            9       19      +10     
  Lines         3090     3481     +391     
===========================================
+ Hits          3010     3407     +397     
+ Misses          80       74       -6     

codecov[bot] avatar Dec 21 '21 21:12 codecov[bot]

Hello @cleder! Thanks for updating this PR. We checked the lines you've touched for PEPΒ 8 issues, and found:

Line 29:9: E741 ambiguous variable name 'l' Line 36:9: E741 ambiguous variable name 'l' Line 56:9: E741 ambiguous variable name 'l' Line 70:9: E741 ambiguous variable name 'l' Line 136:9: E741 ambiguous variable name 'l'

Line 38:13: W503 line break before binary operator Line 38:90: E501 line too long (105 > 89 characters) Line 46:90: E501 line too long (113 > 89 characters) Line 77:90: E501 line too long (94 > 89 characters) Line 90:13: W503 line break before binary operator Line 98:90: E501 line too long (114 > 89 characters)

Line 18:1: F401 'typing.cast' imported but unused Line 20:1: F401 'pytest' imported but unused Line 22:1: F401 'fastkml.config' imported but unused Line 23:1: F401 'fastkml.geometry' imported but unused Line 24:1: F401 'fastkml.types' imported but unused

Line 18:1: F401 'typing.cast' imported but unused Line 20:1: F401 'pytest' imported but unused Line 22:1: F401 'fastkml.config' imported but unused Line 23:1: F401 'fastkml.gx' imported but unused Line 24:1: F401 'fastkml.types' imported but unused

Line 18:1: F401 'typing.cast' imported but unused Line 20:1: F401 'pytest' imported but unused Line 22:1: F401 'fastkml.config' imported but unused Line 23:1: F401 'fastkml.kml' imported but unused Line 24:1: F401 'fastkml.types' imported but unused

Line 138:13: W503 line break before binary operator Line 1720:90: E501 line too long (99 > 89 characters) Line 1734:90: E501 line too long (99 > 89 characters) Line 1749:90: E501 line too long (99 > 89 characters) Line 1753:90: E501 line too long (104 > 89 characters) Line 1789:90: E501 line too long (99 > 89 characters) Line 1793:90: E501 line too long (104 > 89 characters) Line 1797:90: E501 line too long (99 > 89 characters) Line 1818:90: E501 line too long (99 > 89 characters)

Line 321:90: E501 line too long (98 > 89 characters) Line 361:90: E501 line too long (91 > 89 characters) Line 371:90: E501 line too long (109 > 89 characters)

Comment last updated at 2022-02-05 18:44:01 UTC

pep8speaks avatar Dec 22 '21 18:12 pep8speaks

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 2.96 ⭐ 5.80 ⭐ 2.84 πŸ‘Ž
Method Length 72.84 πŸ™‚ 58.75 ⭐ -14.09 πŸ‘
Working memory 6.08 ⭐ 6.57 πŸ™‚ 0.49 πŸ‘Ž
Quality 74.32% πŸ™‚ 71.77% πŸ™‚ -2.55% πŸ‘Ž
Other metrics Before After Change
Lines 4480 2133 -2347
Changed files Quality Before Quality After Quality Change
setup.py 94.14% ⭐ 94.13% ⭐ -0.01% πŸ‘Ž
fastkml/atom.py 76.91% ⭐ 86.96% ⭐ 10.05% πŸ‘
fastkml/base.py 88.91% ⭐ 89.46% ⭐ 0.55% πŸ‘
fastkml/config.py 73.49% πŸ™‚ 92.93% ⭐ 19.44% πŸ‘
fastkml/geometry.py 66.45% πŸ™‚ 65.31% πŸ™‚ -1.14% πŸ‘Ž
fastkml/kml.py 70.34% πŸ™‚ 70.37% πŸ™‚ 0.03% πŸ‘
fastkml/styles.py 73.91% πŸ™‚ 75.11% ⭐ 1.20% πŸ‘

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

File Function Complexity Length Working Memory Quality Recommendation
fastkml/geometry.py Geometry._get_multigeometry 20 😞 265 β›” 11 😞 34.76% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
fastkml/kml.py _Feature.from_element 21 😞 483 β›” 8 πŸ™‚ 35.98% 😞 Refactor to reduce nesting. Try splitting into smaller methods
fastkml/kml.py _Feature.etree_element 21 😞 381 β›” 7 πŸ™‚ 39.34% 😞 Refactor to reduce nesting. Try splitting into smaller methods
fastkml/kml.py Placemark.from_element 7 ⭐ 298 β›” 9 πŸ™‚ 48.44% 😞 Try splitting into smaller methods
fastkml/styles.py StyleMap.from_element 15 πŸ™‚ 163 😞 9 πŸ™‚ 49.59% 😞 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!

sourcery-ai[bot] avatar Feb 05 '22 18:02 sourcery-ai[bot]

πŸ‘‡ 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

ghost avatar Feb 05 '22 18:02 ghost

:warning: The sha of the head commit of this PR conflicts with #170. Mergify cannot evaluate rules on this PR. :warning:

mergify[bot] avatar Oct 06 '22 07:10 mergify[bot]