4 ms·
You mean, for example, running this once a month and keep stats to follow how complexity increase over time or when, in time, it suddenly increase to detect bad
by Narann 11y ago
You mean, for example, running this once a month and keep stats to follow how complexity increase over time or when, in time, it suddenly increase to detect badly merged code?
- pnathan 11y agoGot it in one. Another example: http://betterembsw.blogspot.com/2014/06/avoid-high-cyclomatic-complexity.html http://betterembsw.blogspot.com/2014/06/avoid-high-cyclomati... Keep in mind that these sorts of practices are often used in serious-minded projects where development is intentional and the people doing the work are reflective on the process.
- CyberDildonics 11y agoWhy would you run it only once a month?
- deleted 11y ago[deleted]
- mikegerwitz 11y agoIt's common practice to run tools to calculate complexity as a CI (continuous integration) task. For example, at the company I work for, we check code complexity every time someone pushes to certain branches in our repositories, and mark the build as unstable if the score is too high. In that case, the only acceptable solution is refactoring; all builds must be stable before the task associated with the change can be considered complete. It's not reasonable to run it once a month or longer---by then we've moved on, context and focus have been lost, and refactoring is considerably more expensive (both for development and because it has to go back through QA) than if it were done immediately.
- fapjacks 11y agoHuh, that's pretty cool. Do you have any links to more information? Ideally a write-up/blog post about your environment and how you achieve this?
- rkv 11y agoNot OP but we use Jenkins for our CI which has a plugin[1] which fails builds if a threshold is not met. [1] https://wiki.jenkins-ci.org/display/JENKINS/Checkstyle+Plugin https://wiki.jenkins-ci.org/display/JENKINS/Checkstyle+Plugi...
- mikegerwitz 11y agoYes, this is what we use as well.
- debacle 11y agoOur codebase has commit hooks that detects methods and classes with high complexity and forces you to refactor. There are very few things that cannot be refactored (parsers tend to be one of those things).