Skip to content

Commit cc8530a

Browse files
authored
Merge pull request #36 from PavelBansky/master
Fixed issue with file writer
2 parents d6ab2c0 + e19a859 commit cc8530a

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

src/Microsoft.DevSkim/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public int Run()
140140
Writer outputWriter = WriterFactory.GetWriter(_fileFormat, _outputFormat);
141141
if (string.IsNullOrEmpty(_outputFile))
142142
outputWriter.TextWriter= Console.Out;
143-
else
143+
else
144144
outputWriter.TextWriter = File.CreateText(_outputFile);
145145

146146
int filesAnalyzed = 0;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (C) Microsoft. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
3+
4+
namespace Microsoft.DevSkim.CLI.Writers
5+
{
6+
public class DummyWriter : Writer
7+
{
8+
public override void WriteIssue(IssueRecord issue)
9+
{
10+
// This is intentionaly empty
11+
}
12+
13+
public override void FlushAndClose()
14+
{
15+
// This is intentionaly empty
16+
}
17+
18+
}
19+
}

src/Microsoft.DevSkim/Microsoft.DevSkim.CLI/Writers/IWritter.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Microsoft.DevSkim/Microsoft.DevSkim.CLI/Writers/WriterFactory.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ public class WriterFactory
99
{
1010
public static Writer GetWriter(string writerName, string format = null)
1111
{
12+
if (string.IsNullOrEmpty(writerName))
13+
writerName = "_dummy";
14+
1215
switch (writerName.ToLowerInvariant())
13-
{
16+
{
17+
case "_dummy":
18+
return new DummyWriter();
1419
case "json":
1520
return new JsonWriter(format);
1621
case "text":

0 commit comments

Comments
 (0)