Skip to content

Commit

Permalink
Fixed issue with file writer
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Bansky committed Dec 1, 2017
1 parent ae77c03 commit e19a859
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public int Run()
Writer outputWriter = WriterFactory.GetWriter(_fileFormat, _outputFormat);
if (string.IsNullOrEmpty(_outputFile))
outputWriter.TextWriter= Console.Out;
else
else
outputWriter.TextWriter = File.CreateText(_outputFile);

int filesAnalyzed = 0;
Expand Down
19 changes: 19 additions & 0 deletions src/Microsoft.DevSkim/Microsoft.DevSkim.CLI/Writers/DummyWriter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

namespace Microsoft.DevSkim.CLI.Writers
{
public class DummyWriter : Writer
{
public override void WriteIssue(IssueRecord issue)
{
// This is intentionaly empty
}

public override void FlushAndClose()
{
// This is intentionaly empty
}

}
}
11 changes: 0 additions & 11 deletions src/Microsoft.DevSkim/Microsoft.DevSkim.CLI/Writers/IWritter.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ public class WriterFactory
{
public static Writer GetWriter(string writerName, string format = null)
{
if (string.IsNullOrEmpty(writerName))
writerName = "_dummy";

switch (writerName.ToLowerInvariant())
{
{
case "_dummy":
return new DummyWriter();
case "json":
return new JsonWriter(format);
case "text":
Expand Down

0 comments on commit e19a859

Please sign in to comment.