Skip to content

Commit d9289e0

Browse files
committed
Clean up some task specific logging not suitable for general use
1 parent 26e2202 commit d9289e0

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

src/Microsoft.DotNet.CodeFormatting/FormattingEngineImplementation.cs

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,6 @@ private async Task FormatProjectWithUnspecifiedAnalyzersAsync(Workspace workspac
283283
}
284284
}
285285

286-
private async Task<int> getProjectLinesOfCodeCount(Project project)
287-
{
288-
var allLines = project.Documents.Select(async doc => {
289-
var text = await doc.GetTextAsync();
290-
return text.Lines.Count;
291-
});
292-
var totalLines = await Task.WhenAll(allLines);
293-
return totalLines.Sum();
294-
}
295-
296286
private async Task FormatWithAnalyzersCoreAsync(Workspace workspace, ProjectId projectId, IEnumerable<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken)
297287
{
298288
if (analyzers != null && analyzers.Count() != 0)
@@ -305,32 +295,14 @@ private async Task FormatWithAnalyzersCoreAsync(Workspace workspace, ProjectId p
305295
var extension = StringComparer.OrdinalIgnoreCase.Equals(project.Language, "C#") ? ".csproj" : ".vbproj";
306296
var resultFile = project.FilePath.Substring(project.FilePath.LastIndexOf(Path.DirectorySeparatorChar)).Replace(extension, "_CodeFormatterResults.txt");
307297

308-
var linesOfCodeInProject = -1;
309298
foreach (var analyzer in analyzers)
310299
{
311300
var diags = await _compilationWithAnalyzers.GetAnalyzerDiagnosticsAsync(ImmutableArray.Create(analyzer), cancellationToken);
312301
if (Verbose || LogOutputPath != null)
313302
{
314-
linesOfCodeInProject = linesOfCodeInProject == -1 ? await getProjectLinesOfCodeCount(project) : linesOfCodeInProject;
315303
var analyzerTelemetryInfo = await _compilationWithAnalyzers.GetAnalyzerTelemetryInfoAsync(analyzer, cancellationToken);
316-
var analyzerResultText = string.Format("{0}\t{1}\t{2}\t{3}\t{4}\r\n",
317-
analyzer.ToString(),
318-
project.Documents.Count(),
319-
linesOfCodeInProject,
320-
diagnostics.Count(),
321-
analyzerTelemetryInfo.ExecutionTime);
322-
323-
if (Verbose)
324-
{
325-
FormatLogger.Write(analyzerResultText);
326-
}
327-
328-
if (LogOutputPath != null)
329-
{
330-
var resultPath = LogOutputPath + resultFile;
331-
LogDiagnostics(Path.ChangeExtension(resultPath, "json"), diags);
332-
File.AppendAllText(resultPath, analyzerResultText);
333-
}
304+
var resultPath = Path.ChangeExtension(LogOutputPath + resultFile, "json");
305+
LogDiagnostics(resultPath, diags);
334306
}
335307
}
336308
}

0 commit comments

Comments
 (0)