pyuvsim icon indicating copy to clipboard operation
pyuvsim copied to clipboard

flake8 max-complexity

Open steven-murray opened this issue 5 years ago • 5 comments

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.

steven-murray avatar Jul 22 '19 18:07 steven-murray

(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.

aelanman avatar Jul 22 '19 18:07 aelanman

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.

bhazelton avatar Jul 22 '19 18:07 bhazelton

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 avatar Jul 22 '19 18:07 steven-murray

@steven-murray Anything still planned here?

jpober avatar Jul 20 '20 17:07 jpober

I still think this is important, but haven't had time to get to it.

steven-murray avatar Jul 21 '20 14:07 steven-murray