@@ -88,7 +88,7 @@ private static void AddProjectMetrics(string projectName, string relativeProject
8888 public static int AnalyzeSourceFile ( string ? solutionDirectory , List < NamespaceMetrics > namespaceMetrics , string projectName , string relativeProjectPath , int projectLineCount , Dictionary < string , int > projectNamespaceMetrics , string file )
8989 {
9090 var lines = File . ReadAllLines ( file ) ;
91- AnalyzeSourceCode ( projectNamespaceMetrics , file , lines , out string ? currentNamespace , out int fileLineCount , out int fileCyclomaticComplexity ) ;
91+ AnalyzeSourceCode ( projectNamespaceMetrics , lines , out string ? currentNamespace , out int fileLineCount , out int fileCyclomaticComplexity ) ;
9292
9393 namespaceMetrics . Add ( new NamespaceMetrics
9494 {
@@ -104,7 +104,7 @@ public static int AnalyzeSourceFile(string? solutionDirectory, List<NamespaceMet
104104 return projectLineCount + fileLineCount ;
105105 }
106106
107- public static void AnalyzeSourceCode ( Dictionary < string , int > projectNamespaceMetrics , string file , string [ ] lines , out string ? currentNamespace , out int fileLineCount , out int fileCyclomaticComplexity )
107+ public static void AnalyzeSourceCode ( Dictionary < string , int > projectNamespaceMetrics , string [ ] lines , out string ? currentNamespace , out int fileLineCount , out int fileCyclomaticComplexity )
108108 {
109109 currentNamespace = null ;
110110 fileLineCount = 0 ;
@@ -118,10 +118,7 @@ public static void AnalyzeSourceCode(Dictionary<string, int> projectNamespaceMet
118118
119119 foreach ( var line in lines )
120120 {
121- if ( currentNamespace == null )
122- {
123- currentNamespace = ExtractNameSpace ( projectNamespaceMetrics , currentNamespace , line ) ;
124- }
121+ currentNamespace ??= ExtractNameSpace ( projectNamespaceMetrics , currentNamespace , line ) ;
125122
126123 if ( IsCodeLineUsingRoslyn ( line ) )
127124 {
0 commit comments