This document outlines the definition of file metrics for C#.
The "complexity" metric counts:
if
andelse if
statements- Uses of the ternary operator
condition ? then : otherwise
- Null-coalescing operators
??
and??=
- Loops, including
for
loops andforeach
loopswhile
loopsdo-while
loops
case
labels in switch-statements- Not-default switch expression arms in switch expressions
x switch { value1 => expression1, ...}
catch
blocks- logical binary operations
&&
and||
- pattern combinators
and
andor
- everything counted for the "functions" metric
It does not count:
- case guards with the keyword
when
- Default switch expression arms with syntax
_ => expression
goto
labels
The "functions" metric counts:
- methods and the accessors
get
,set
andinit
in classes, abstract classes, interfaces and records - constructors
- lambda expressions
The "classes" metric counts:
- definitions of
class
,abstract class
,interface
,enum
andrecord
see README.md