so I’m opening this as a brainstorming topic on a maybe sensitive subject which is the ClassFanOutComplexity metric that we use with Checkstyle. Right now the CFOC threshold is 20 and I’m wondering if:
- we should keep this metric
- we should keep this threshold
I’m starting this discussion because that’s the checkstyle issue I hit the most often when I develop new stuff in XWiki, and the solution to fix those are generally not obvious to avoid adding meaningless classes just there to pass the checkstyle. Another reason is that I’ve just seen this issue: https://jira.xwiki.org/browse/XCOMMONS-2294 which appears related to a fix of checkstyle which was badly counting the CFOC. When they will solve it we might discover new issues in our existing code.
Finally a last reason, is that I googled “how to reduce class fan out complexity” (don’t judge me :)) and I surprisingly found first this XWiki markmail archive: http://markmail.org/message/snun6avp3qlkg54k
So clearly not the first time the subject is on the table, but just to add some information, after reading it I checked and apparently Checkstyle itself doesn’t use a threshold of 20 for CFOC, they use 25: https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L647
So I’m not proposing right now that we increase our value, even if I’d like it, just wondering what do you think about this metric nowadays? I know that on my side I really don’t like it and I don’t find it very useful personally. We could check but I think most of the checkstyle problems we ignore are actually related to this one.
So, sorry for this hot topic, hope it won’t become a flamewar but would be interesting to know your opinion.