-
Is there a way to see some diagnostic explaining why ComplexMethod is triggered? (more precisely why complexity score is what it is) I sometimes get ComplexMethod for functions with local functions and I struggle to see why.... |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
This rule uses McCabe’s Cyclomatic Complexity (MCC) metric to measure the number of linearly independent paths through a function’s source code (https://www.ndepend.com/docs/code-metrics#CC). The higher the number of independent paths, the more complex a method is. |
Beta Was this translation helpful? Give feedback.
-
Thanks for sending the link to Ideally a dump or log showing the paths and how they contribute to a score (ideally I see it as some highlighting of if/while/for... contributing to the score in the plugin when the cursor is in the function name) would be great. |
Beta Was this translation helpful? Give feedback.
-
Given As For starters, just log (println) on each *) for example I'd see this in terminal which started Android Studio:
for some |
Beta Was this translation helpful? Give feedback.
-
For exactly this reason, detekt includes the possibility to extend the feature set by using custom rules and reports. |
Beta Was this translation helpful? Give feedback.
This rule uses McCabe’s Cyclomatic Complexity (MCC) metric to measure the number of linearly independent paths through a function’s source code (https://www.ndepend.com/docs/code-metrics#CC). The higher the number of independent paths, the more complex a method is.
Source