Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354535

Summary: Eclipse C/C++ Code complexity
Product: [Tools] CDT Reporter: andy Mising name <andreas.back>
Component: cdt-codanAssignee: CDT Codan Inbox <cdt-codan-inbox>
Status: NEW --- QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: enhancement    
Priority: P3 CC: cdtdoug, yevshif
Version: 8.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 350856    
Bug Blocks:    
Attachments:
Description Flags
Error rate as a function of complexity none

Description andy Mising name CLA 2011-08-11 13:36:25 EDT
Build Identifier: 

Make it possible to have coderules and color coding based on the cylocmatic complexity.

E.g in JSF the limit is 20 in AV Rule 3
http://www.jsf.mil/downloads/documents/JSF_AV_C++_Coding_Standards_Rev_C.doc


Other information on the subject
Links on the subject:
http://www.enerjy.com/blog/?p=198
http://www.scribd.com/doc/49763722/24/Cyclomatic-complexity


Also a thesis made this year in the subject.
http://pure.ltu.se/portal/files/33040726/LTU-EX-2011-32994156.pdf


Based on http://dev.eclipse.org/mhonarc/lists/cdt-dev/msg22725.html



Reproducible: Couldn't Reproduce
Comment 1 andy Mising name CLA 2011-08-16 14:56:00 EDT
Created attachment 201600 [details]
Error rate as a function of complexity

This picture from http://www.enerjy.com/blog/?p=198 exaplains this quite good
Comment 2 andy Mising name CLA 2011-08-16 15:04:54 EDT
One could use color coding on functions based on these old SEI results 

E.g based from http://www.scribd.com/doc/49763722/24/Cyclomatic-complexity
1-10 Simple program, without much risk
11-20 Complexity and moderate risk
21-50 Complex, high risk
Above 50 Not testable, high risk


E.g 
green 1-20
Yellow 21-50
Red 51-

or 

green 1-10
orange 11-20
Yellow 21-50
Red 51 -

What do you think
Comment 3 andy Mising name CLA 2012-03-03 09:49:16 EST
This is quite similar to another case here
https://bugs.eclipse.org/bugs/show_bug.cgi?id=372722