adbar / htmldate

Fast and robust date extraction from web pages, with Python or on the command-line
https://htmldate.readthedocs.io
Apache License 2.0
117 stars 26 forks source link

Sourcery refactored master branch #63

Closed sourcery-ai[bot] closed 1 year ago

sourcery-ai[bot] commented 1 year ago

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^

Help us improve this pull request!

sourcery-ai[bot] commented 1 year ago

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 21.47 😞 21.01 😞 -0.46 👍
Method Length 140.40 😞 139.44 😞 -0.96 👍
Working memory 13.36 😞 13.34 😞 -0.02 👍
Quality 42.01% 😞 42.11% 😞 0.10% 👍
Other metrics Before After Change
Lines 2147 2132 -15
Changed files Quality Before Quality After Quality Change
htmldate/core.py 21.41% ⛔ 21.97% ⛔ 0.56% 👍
htmldate/extractors.py 51.52% 🙂 50.62% 🙂 -0.90% 👎
htmldate/validators.py 65.64% 🙂 66.27% 🙂 0.63% 👍
tests/comparison.py 59.13% 🙂 59.28% 🙂 0.15% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
htmldate/core.py examine_header 75 ⛔ 490 ⛔ 19 ⛔ 6.06% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
htmldate/core.py examine_time_elements 53 ⛔ 258 ⛔ 22 ⛔ 10.86% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
htmldate/core.py examine_abbr_elements 54 ⛔ 229 ⛔ 21 ⛔ 12.77% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
htmldate/extractors.py custom_parse 44 ⛔ 490 ⛔ 15 😞 13.51% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
htmldate/core.py search_page 26 😞 639 ⛔ 22 ⛔ 14.74% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

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!

codecov-commenter commented 1 year ago

Codecov Report

Merging #63 (d0afa53) into master (d0afa53) will not change coverage. The diff coverage is n/a.

:exclamation: Current head d0afa53 differs from pull request most recent head 6991d89. Consider uploading reports for the commit 6991d89 to get more accurate results

@@           Coverage Diff           @@
##           master      #63   +/-   ##
=======================================
  Coverage   98.40%   98.40%           
=======================================
  Files           8        8           
  Lines         939      939           
=======================================
  Hits          924      924           
  Misses         15       15           

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