Home > Code Analysis > Code Issues – Complex Member

Code Issues – Complex Member

July 27th, 2011

The Complex Member code issue of the smell type highlights complex members. A complex member is a member that may have too much code inside. The issue is based on a calculation of the Maintenance Complexity code metric. Maintenance complexity is a measure the structural complexity of a node (and its children), and represents how easy or challenging a method will be to understand and maintain. Scores closer to zero are simple. Small methods usually score below 150, while large/complex methods will exceed 500.

Here’s the table of the ideal scores for this code metric:

When a member’s maintenance complexity exceeds a threshold of 800 points, you will see the member highlighted:

CodeRush Complex Member code issue

How to fix:

It is recommended to break down a complex member into smaller methods, using the Extract Method refactoring, for example.

—–
Products: CodeRush Pro
Versions: 12.1 and up
VS IDEs: 2008 and up
Updated: Nov/12/2012
ID: C118

Similar Posts: