
GNU complexity 1.5 - lelf
http://lists.gnu.org/archive/html/info-gnu/2016-02/msg00012.html
======
wspeirs
How has this been here for 30+ minutes and no one has posted the complexity of
the Linux kernel, gcc compiler, and of course the complexity program itself?

~~~
jhallenworld
Well I had to try this on JOE, the highest score is:

    
    
       1613     359     325   regex.c(1260): joe_regexec
    

The manual has:

    
    
        ‘50-99’ Unmaintainable code. 
        ‘100-199’ Crazy making difficult code. 
        ‘200+’ I only wish I were kidding.
         	
        Score | ln-ct | nc-lns| file-name(line): proc-name
         4707    3815    2838   lib/vasnprintf.c(1747): VASNPRINTF
    
    

The golang compiler should include this technology and refuse to compile files
which it decides are too complex for you to maintain.

~~~
mmargerum
Doesn't go compile itself now?

------
Narann
Naive question: What the practical usage of this? Detect complex functions in
huge code base?

~~~
pnathan
When you're estimating the maintainability of a codebase over time and
identifing modules that are overly complex (i.e., buggy), these kinds of tools
are invaluable.

~~~
Narann
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?

~~~
mikegerwitz
It'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
Huh, 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
Not 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+Plugi...](https://wiki.jenkins-
ci.org/display/JENKINS/Checkstyle+Plugin)

~~~
mikegerwitz
Yes, this is what we use as well.

------
justifier
assumed it was going to have something to do with computational complexity

is there similar software that one can pass source code to and get a detailed
look at the overall and individual computational complexity?

------
hjek
Is there anything like this for Javascript?

~~~
dalke
Perhaps one of the ones in
[http://stackoverflow.com/questions/100645/calculate-
cyclomat...](http://stackoverflow.com/questions/100645/calculate-cyclomatic-
complexity-for-javascript) ?

