aeakoski / scrapy

Scrapy, a fast high-level web crawling & scraping framework for Python.
https://scrapy.org
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Refactor: _next_request lower complexity #31

Closed oskarek closed 3 years ago

oskarek commented 6 years ago

The _next_request function is refactored to decrease its cyclomatic complexity. This is done by moving some complexity into separate functions.

will fix #30

oskarek commented 6 years ago

This is a calculations of the cyclomatic complexity before doing the refactoring:

cc_before

And this is after:

cc_after

(N = number of nodes, E = number of edges, CC = cyclomatic complexity)

We can see that the complexity has dropped from 11 to 7, which is a decrease of 36%.