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
118 stars 26 forks source link

Sourcery refactored master branch #71

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

Quality metrics Before After Change
Complexity 21.08 😞 20.59 😞 -0.49 👍
Method Length 129.62 😞 129.10 😞 -0.52 👍
Working memory 12.68 😞 12.79 😞 0.11 👎
Quality 44.05% 😞 44.09% 😞 0.04% 👍
Other metrics Before After Change
Lines 2450 2440 -10
Changed files Quality Before Quality After Quality Change
htmldate/core.py 20.19% ⛔ 20.40% ⛔ 0.21% 👍
htmldate/extractors.py 51.09% 🙂 50.37% 🙂 -0.72% 👎
htmldate/utils.py 68.60% 🙂 69.33% 🙂 0.73% 👍
htmldate/validators.py 66.32% 🙂 66.27% 🙂 -0.05% 👎
tests/comparison.py 59.21% 🙂 59.25% 🙂 0.04% 👍

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 74 ⛔ 490 ⛔ 19 ⛔ 6.11% ⛔ 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 search_page 31 😞 692 ⛔ 22 ⛔ 12.10% ⛔ 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 examine_abbr_elements 54 ⛔ 223 ⛔ 20 ⛔ 13.71% ⛔ 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!