pyuvsim
pyuvsim copied to clipboard
flake8 max-complexity
It is my naive understanding that the max-complexity should be set to around 18 to keep code reasonably simple. It is set to 30 currently since some of the functions are too complex. This should be addressed.
(moving my comment on the closed PR to here)
From your example, it looks like the functions that were more complex than 18 were setup functions that necessarily cover a wide variety of setup configurations. All of the configuration cases are tested for consistency. I'm not sure if there is a way to reduce their cyclomatic complexity while maintaining their general usefulness.
The suggestion from the wikipedia article is that highly complex functions should be candidates for refactoring into smaller modules. I haven't looked at this code, but looking for repeated logic that could be pulled out and then re-used makes sense.
I agree with @bhazelton. I will have a look today at least at a couple, and see if I can get a way to reduce the complexity. I might need a bit of help from @aelanman.
@steven-murray Anything still planned here?
I still think this is important, but haven't had time to get to it.