cc - Cyclomatic Complexity

Overview

The cc command calculates cyclomatic complexity for C# methods in your projects or directories. Cyclomatic complexity is a software metric that measures the number of linearly independent paths through a program’s source code, helping you identify overly complex methods that may be difficult to test and maintain.

Syntax

nmbl cc <ProjectFileOrDirectory>

Arguments

Output

Displays a table of methods with their cyclomatic complexity scores, ordered by complexity (highest first). This helps you quickly identify the most complex methods in your codebase.

Examples

Analyze a Specific Project

nmbl cc src/MyProject/MyProject.csproj

Calculates complexity for all methods in the specified project.

Analyze All Projects in a Directory

nmbl cc src/

Recursively analyzes all C# files in the directory tree.

Analyze Current Directory

nmbl cc .

Analyzes all C# files in the current directory and subdirectories.

Understanding the Results

Methods with higher cyclomatic complexity scores are generally:

Complexity Guidelines: