GNU complexity is a command line tool that computes a complexity measure of C source code, similar to pmccabe, but with a different method of calculating results with short functions scoring lower than pmccabe and highly nested functionality can score considerably higher. It can be useful to locate suspicious areas in unfamiliar code, get an idea of the efforts required to either understand the code or test it, or self-assess your own code. Bruce Korb, the maintainer, has just released version 1.5 with some bug fixes, so I’ve given it a quick try. We’ll need to get the code, build and install it first: The user’s manual provides some insights and an example, which I’ve used against a directory in Linux source code: The resulting table shows six information per line: the computed score, the number of lines between the opening and closing curly braces (ln-ct), the number of non-comment, non-blank lines found there (nc-lns), the name of the source …
Continue reading… “GNU Complexity Command Line Tool Measures Complexity of C Code”
Support CNX Software – Donate via PayPal or become a Patron on Patreon |