hydromad icon indicating copy to clipboard operation
hydromad copied to clipboard

Look into cyclomatic complexity

Open josephguillaume opened this issue 4 years ago • 3 comments

lintr:

##[warning]functions should have cyclomatic complexity of less than 15

josephguillaume avatar Jul 01 '20 01:07 josephguillaume

@jnothman - we might need some advice on how to deal with this one

josephguillaume avatar Jul 01 '20 01:07 josephguillaume

You need to run lintr locally to see where the problem is ;) But basically it's saying "This function can't be tested or easily reasoned about as a unit because it has too many independent conditionals. Split it into multiple functions."

It's an issue that needs case-by-case treatment. It's also an instance where it is truly only a warning, not a reason to refuse a contribution.

jnothman avatar Jul 01 '20 04:07 jnothman

Thanks! I'll have another look when the number of lintr warnings goes down. I assume there's a way of suppressing the lintr warning for a particular function if needed, with some decorator.

josephguillaume avatar Jul 01 '20 05:07 josephguillaume