11
11
using ArchiMetrics . Common . Metrics ;
12
12
using MetricsExtractor . Custom ;
13
13
using MetricsExtractor . ReportTemplate ;
14
- using Microsoft . CodeAnalysis ;
15
14
using Microsoft . CodeAnalysis . Options ;
16
15
17
16
namespace MetricsExtractor
@@ -33,6 +32,7 @@ static void Main(string[] args)
33
32
34
33
var runCodeMetrics = RunCodeMetrics ( metricConfiguration . Solution , metricConfiguration . IgnoredProjects ) ;
35
34
runCodeMetrics . Wait ( ) ;
35
+ Console . WriteLine ( "All projects measure, creating report" ) ;
36
36
var ignoredNamespaces = metricConfiguration . IgnoredNamespaces ?? Enumerable . Empty < string > ( ) ;
37
37
var namespaceMetrics = runCodeMetrics . Result . Where ( nm => ! ignoredNamespaces . Contains ( nm . Name ) ) . ToList ( ) ;
38
38
@@ -62,7 +62,7 @@ private static string GenerateReport(EstadoDoProjeto resultadoGeral, string solu
62
62
var reportTemplateFactory = new ReportTemplateFactory ( ) ;
63
63
var report = reportTemplateFactory . GetReport ( resultadoGeral ) ;
64
64
var list = new [ ] { "*.css" , "*.js" } . SelectMany ( ext => Directory . GetFiles ( Path . Combine ( ApplicationPath , "ReportTemplate" ) , ext ) ) . ToList ( ) ;
65
-
65
+
66
66
67
67
Directory . CreateDirectory ( reportDirectory ) ;
68
68
using ( var zipArchive = new ZipArchive ( File . OpenWrite ( reportPath ) , ZipArchiveMode . Create ) )
@@ -140,26 +140,15 @@ private static async Task<IEnumerable<INamespaceMetric>> RunCodeMetrics(string s
140
140
141
141
Console . WriteLine ( "Loading metrics, wait it may take a while." ) ;
142
142
143
- var tasks = projects . Select ( async project =>
143
+ var metrics = new List < IEnumerable < INamespaceMetric > > ( ) ;
144
+ var metricsCalculator = new CodeMetricsCalculator ( ) ;
145
+ foreach ( var project in projects )
144
146
{
145
- var metrics = new List < INamespaceMetric > ( ) ;
146
- using ( new TimerMeasure ( string . Format ( "Loading metrics from project {0}" , project . Name ) , string . Format ( "{0} metrics loaded" , project . Name ) ) )
147
- {
148
- var namespaceMetrics = await CreateTask ( project , solution ) . ConfigureAwait ( false ) ;
149
- metrics . AddRange ( namespaceMetrics ) ;
150
- }
151
- return metrics ;
152
- } ) ;
153
-
154
- var nms = await Task . WhenAll ( tasks ) . ConfigureAwait ( false ) ;
155
-
156
- return nms . SelectMany ( nm => nm ) ;
157
- }
147
+ var calculate = await metricsCalculator . Calculate ( project , solution ) ;
148
+ metrics . Add ( calculate ) ;
149
+ }
158
150
159
- private static Task < IEnumerable < INamespaceMetric > > CreateTask ( Project p , Solution solution )
160
- {
161
- var metricsCalculator = new CodeMetricsCalculator ( ) ;
162
- return metricsCalculator . Calculate ( p , solution ) ;
151
+ return metrics . SelectMany ( nm => nm ) ;
163
152
}
164
153
165
154
private static IEnumerable < TypeMetricWithNamespace > CreateClassesRank ( List < TypeMetricWithNamespace > types )
0 commit comments