hhursev / recipe-scrapers

Python package for scraping recipes data
MIT License
1.62k stars 508 forks source link

Refactor the utils.get_minutes method #996

Closed jayaddison closed 5 months ago

jayaddison commented 5 months ago

The _utils.get_minutes method has a high McCabe cyclomatic complexity, meaning that flake8 would complain about it if we didn't suppress the relevant C901 warning.

Although not perfect, a high complexity score is usually a good indicator that some code could be refactored into something cleaner.

I've wanted to try this for a while, and I'll see how far I get with this branch. There are a few inter-dependencies (exception handling, plugins, zero-value handling, ...), not to mention that we only have a few tests per scraper, so a few experiments may be required along the way.

jayaddison commented 5 months ago

@hhursev @jknndy @strangetom I feel like I could tinker with this refactor forever, but should probably stop. What do you think of the changes? Any other / additional ideas for cleanup?

(the schemaorg constructor could be next on the refactor project list)