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 #60

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.21%.

Quality metrics Before After Change
Complexity 20.64 😞 20.02 😞 -0.62 👍
Method Length 118.00 🙂 117.05 🙂 -0.95 👍
Working memory 13.32 😞 13.29 😞 -0.03 👍
Quality 43.85% 😞 44.06% 😞 0.21% 👍
Other metrics Before After Change
Lines 2286 2262 -24
Changed files Quality Before Quality After Quality Change
setup.py 92.73% ⭐ 92.79% ⭐ 0.06% 👍
htmldate/core.py 21.53% ⛔ 22.40% ⛔ 0.87% 👍
htmldate/extractors.py 52.73% 🙂 51.94% 🙂 -0.79% 👎
htmldate/settings.py 82.33% ⭐ 82.33% ⭐ 0.00%
htmldate/validators.py 67.63% 🙂 68.34% 🙂 0.71% 👍
tests/comparison.py 59.75% 🙂 59.89% 🙂 0.14% 👍

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 ⛔ 425 ⛔ 18 ⛔ 7.31% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
htmldate/core.py examine_time_elements 53 ⛔ 224 ⛔ 22 ⛔ 12.72% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
htmldate/core.py examine_abbr_elements 54 ⛔ 207 ⛔ 21 ⛔ 14.22% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
htmldate/core.py search_page 26 😞 569 ⛔ 22 ⛔ 14.87% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
htmldate/extractors.py custom_parse 40 ⛔ 442 ⛔ 15 😞 14.94% ⛔ 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!