diff --git a/docs/usage.md b/docs/usage.md
index d834be6..360e472 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -40,10 +40,10 @@ Here we are taking `CS0219` which is normally a warning and forcing it to be rep
#### CheckRunConfiguration [src](https://github.com/justaprogrammer/BCC-MSBuildLog/blob/master/src/BCC.MSBuildLog/Model/CheckRunConfiguration.cs)
-+ rules (array[LogAnalyzerRule]) - Array of rules
-+ name (string)
+- rules (array[LogAnalyzerRule]) - Array of rules
+- name (string)
#### LogAnalyzerRule [src](https://github.com/justaprogrammer/BCC-MSBuildLog/blob/master/src/BCC.MSBuildLog/Model/LogAnalyzerRule.cs)
-+ code (string, required) - The MSBuild warning/error code to match against
-+ reportAs: asIs, ignore, notice, warning, error (enum, required)
\ No newline at end of file
+- code (string, required) - The MSBuild warning/error code to match against
+- reportAs: asIs, ignore, notice, warning, error (enum, required)
\ No newline at end of file
diff --git a/src/BCC.MSBuildLog.Tests/Services/BinaryLogProcessorTests.cs b/src/BCC.MSBuildLog.Tests/Services/BinaryLogProcessorTests.cs
index 1802114..33fb6ca 100644
--- a/src/BCC.MSBuildLog.Tests/Services/BinaryLogProcessorTests.cs
+++ b/src/BCC.MSBuildLog.Tests/Services/BinaryLogProcessorTests.cs
@@ -46,7 +46,7 @@ public void Should_TestConsoleApp1_Warning()
"TestConsoleApp1/Program.cs",
13,
13,
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
"The variable 'hello' is assigned but its value is never used")
{
Title = "CS0219: TestConsoleApp1/Program.cs(13)"
@@ -81,7 +81,7 @@ public void Should_TestConsoleApp1_Warning_ConfigureAs_Warning_For_Other_Code()
"TestConsoleApp1/Program.cs",
13,
13,
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
"The variable 'hello' is assigned but its value is never used")
{
Title = "CS0219: TestConsoleApp1/Program.cs(13)"
@@ -116,7 +116,7 @@ public void Should_TestConsoleApp1_Warning_ConfigureAs_Warning()
"TestConsoleApp1/Program.cs",
13,
13,
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
"The variable 'hello' is assigned but its value is never used")
{
Title = "CS0219: TestConsoleApp1/Program.cs(13)"
@@ -151,7 +151,7 @@ public void Should_TestConsoleApp1_Warning_ConfigureAs_Notice()
"TestConsoleApp1/Program.cs",
13,
13,
- CheckWarningLevel.Notice,
+ AnnotationLevel.Notice,
"The variable 'hello' is assigned but its value is never used")
{
Title = "CS0219: TestConsoleApp1/Program.cs(13)"
@@ -186,7 +186,7 @@ public void Should_TestConsoleApp1_Warning_ConfigureAs_Error()
"TestConsoleApp1/Program.cs",
13,
13,
- CheckWarningLevel.Failure,
+ AnnotationLevel.Failure,
"The variable 'hello' is assigned but its value is never used")
{
Title = "CS0219: TestConsoleApp1/Program.cs(13)"
@@ -232,7 +232,7 @@ public void Should_TestConsoleApp1_Error()
"TestConsoleApp1/Program.cs",
13,
13,
- CheckWarningLevel.Failure,
+ AnnotationLevel.Failure,
"; expected")
{
Title = "CS1002: TestConsoleApp1/Program.cs(13)"
@@ -256,7 +256,7 @@ public void Should_TestConsoleApp1_CodeAnalysis()
"TestConsoleApp1/Program.cs",
20,
20,
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
"Microsoft.Usage : 'Program.MyClass' contains field 'Program.MyClass._inner' that is of IDisposable type: 'Program.MyOTherClass'. Change the Dispose method on 'Program.MyClass' to call Dispose or Close on this field.")
{
Title = "CA2213: TestConsoleApp1/Program.cs(20)"
@@ -282,7 +282,7 @@ public void Should_MSBLOC()
"MSBLOC.Core.Tests/Services/BinaryLogProcessorTests.cs",
56,
56,
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
"The variable 'filename' is assigned but its value is never used")
{
Title = "CS0219: MSBLOC.Core.Tests/Services/BinaryLogProcessorTests.cs(56)"
@@ -293,7 +293,7 @@ public void Should_MSBLOC()
"MSBLOC.Core.Tests/Services/BinaryLogProcessorTests.cs",
83,
83,
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
"The variable 'filename' is assigned but its value is never used")
{
Title = "CS0219: MSBLOC.Core.Tests/Services/BinaryLogProcessorTests.cs(83)"
@@ -318,7 +318,7 @@ public void Should_Parse_OctokitGraphQL()
"Octokit.GraphQL.Core/Connection.cs",
43,
43,
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
"Missing XML comment for publicly visible type or member 'Connection.Uri'")
{
Title = "CS1591: Octokit.GraphQL.Core/Connection.cs(43)"
@@ -329,7 +329,7 @@ public void Should_Parse_OctokitGraphQL()
"Octokit.GraphQL.Core/Connection.cs",
44,
44,
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
"Missing XML comment for publicly visible type or member 'Connection.CredentialStore'")
{
Title = "CS1591: Octokit.GraphQL.Core/Connection.cs(44)"
diff --git a/src/BCC.MSBuildLog.Tests/Services/BuildLogProcessorTests.cs b/src/BCC.MSBuildLog.Tests/Services/BuildLogProcessorTests.cs
index 1b75045..f35c9a8 100644
--- a/src/BCC.MSBuildLog.Tests/Services/BuildLogProcessorTests.cs
+++ b/src/BCC.MSBuildLog.Tests/Services/BuildLogProcessorTests.cs
@@ -108,7 +108,7 @@ public void Should_Create_CheckRun_With_Warning()
Faker.System.FilePath(),
Faker.Random.Int(),
Faker.Random.Int(),
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
Faker.Lorem.Word())
};
@@ -130,7 +130,7 @@ public void Should_Create_CheckRun_With_Configuration()
Faker.System.FilePath(),
Faker.Random.Int(),
Faker.Random.Int(),
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
Faker.Lorem.Word())
};
@@ -174,7 +174,7 @@ public void Should_Create_CheckRun_With_Failure()
Faker.System.FilePath(),
Faker.Random.Int(),
Faker.Random.Int(),
- CheckWarningLevel.Failure, Faker.Lorem.Word())
+ AnnotationLevel.Failure, Faker.Lorem.Word())
};
var mockBinaryLogProcessor = CreateMockBinaryLogProcessor(annotations, Faker.Lorem.Paragraph(), 0, 1);
@@ -196,13 +196,13 @@ public void Should_Create_CheckRun_With_WarningAndFailure()
Faker.System.FilePath(),
Faker.Random.Int(),
Faker.Random.Int(),
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
Faker.Lorem.Word()),
new Annotation(
Faker.System.FilePath(),
Faker.Random.Int(),
Faker.Random.Int(),
- CheckWarningLevel.Failure,
+ AnnotationLevel.Failure,
Faker.Lorem.Word())
};
@@ -225,7 +225,7 @@ public void Should_Create_CheckRun_TestConsoleApp1_Warning()
"TestConsoleApp1/Program.cs",
13,
13,
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
"The variable 'hello' is assigned but its value is never used")
{
Title = "CS0219: TestConsoleApp1/Program.cs(13)"
@@ -254,7 +254,7 @@ public void Should_Create_CheckRun_TestConsoleApp1_Error()
"TestConsoleApp1/Program.cs",
13,
13,
- CheckWarningLevel.Failure,
+ AnnotationLevel.Failure,
"; expected")
{
Title = "CS1002: TestConsoleApp1/Program.cs(13)"
@@ -283,7 +283,7 @@ public void Should_Create_CheckRun_TestConsoleApp1_CodeAnalysis()
"TestConsoleApp1/Program.cs",
20,
20,
- CheckWarningLevel.Warning,
+ AnnotationLevel.Warning,
"Microsoft.Usage : 'Program.MyClass' contains field 'Program.MyClass._inner' that is of IDisposable type: 'Program.MyOTherClass'. Change the Dispose method on 'Program.MyClass' to call Dispose or Close on this field.")
{
Title = "CA2213: TestConsoleApp1/Program.cs(20)"
diff --git a/src/BCC.MSBuildLog/BCC.MSBuildLog.csproj b/src/BCC.MSBuildLog/BCC.MSBuildLog.csproj
index 537757e..d8148e2 100644
--- a/src/BCC.MSBuildLog/BCC.MSBuildLog.csproj
+++ b/src/BCC.MSBuildLog/BCC.MSBuildLog.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/src/BCC.MSBuildLog/Services/BinaryLogProcessor.cs b/src/BCC.MSBuildLog/Services/BinaryLogProcessor.cs
index 3bd972e..fa8fa4a 100644
--- a/src/BCC.MSBuildLog/Services/BinaryLogProcessor.cs
+++ b/src/BCC.MSBuildLog/Services/BinaryLogProcessor.cs
@@ -52,7 +52,7 @@ public LogData ProcessLog(string binLogPath, string cloneRoot, string owner, str
if (buildWarning == null && buildError == null)
continue;
- CheckWarningLevel checkWarningLevel;
+ AnnotationLevel checkWarningLevel;
string buildCode;
string projectFile;
string file;
@@ -66,7 +66,7 @@ public LogData ProcessLog(string binLogPath, string cloneRoot, string owner, str
warningCount++;
recordTypeString = "Warning";
- checkWarningLevel = CheckWarningLevel.Warning;
+ checkWarningLevel = AnnotationLevel.Warning;
buildCode = buildWarning.Code;
projectFile = buildWarning.ProjectFile;
file = buildWarning.File;
@@ -80,7 +80,7 @@ public LogData ProcessLog(string binLogPath, string cloneRoot, string owner, str
errorCount++;
recordTypeString = "Error";
- checkWarningLevel = CheckWarningLevel.Failure;
+ checkWarningLevel = AnnotationLevel.Failure;
buildCode = buildError.Code;
projectFile = buildError.ProjectFile;
file = buildError.File;
@@ -118,13 +118,13 @@ public LogData ProcessLog(string binLogPath, string cloneRoot, string owner, str
case ReportAs.AsIs:
break;
case ReportAs.Notice:
- checkWarningLevel = CheckWarningLevel.Notice;
+ checkWarningLevel = AnnotationLevel.Notice;
break;
case ReportAs.Warning:
- checkWarningLevel = CheckWarningLevel.Warning;
+ checkWarningLevel = AnnotationLevel.Warning;
break;
case ReportAs.Error:
- checkWarningLevel = CheckWarningLevel.Failure;
+ checkWarningLevel = AnnotationLevel.Failure;
break;
default:
throw new ArgumentOutOfRangeException();
@@ -167,7 +167,7 @@ public LogData ProcessLog(string binLogPath, string cloneRoot, string owner, str
};
}
- private Annotation CreateAnnotation(CheckWarningLevel checkWarningLevel, [NotNull] string cloneRoot, [NotNull] string title, [NotNull] string message, int lineNumber, int endLineNumber, string getFilePath)
+ private Annotation CreateAnnotation(AnnotationLevel checkWarningLevel, [NotNull] string cloneRoot, [NotNull] string title, [NotNull] string message, int lineNumber, int endLineNumber, string getFilePath)
{
if (cloneRoot == null)
{
diff --git a/src/BCC.MSBuildLog/Services/BuildLogProcessor.cs b/src/BCC.MSBuildLog/Services/BuildLogProcessor.cs
index 952c9f4..f42976f 100644
--- a/src/BCC.MSBuildLog/Services/BuildLogProcessor.cs
+++ b/src/BCC.MSBuildLog/Services/BuildLogProcessor.cs
@@ -10,6 +10,8 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using Newtonsoft.Json.Serialization;
namespace BCC.MSBuildLog.Services
{
@@ -57,14 +59,23 @@ public void Proces(string inputFile, string outputFile, string cloneRoot, string
throw new InvalidOperationException($"Content of configuration file `{configurationFile}` is null or empty.");
}
- configuration = JsonConvert.DeserializeObject(configurationString);
+ configuration = JsonConvert.DeserializeObject(configurationString, new JsonSerializerSettings
+ {
+ Formatting = Formatting.None,
+ ContractResolver = new CamelCasePropertyNamesContractResolver(),
+ Converters = new List
+ {
+ new StringEnumConverter { NamingStrategy = new CamelCaseNamingStrategy() }
+ },
+ MissingMemberHandling = MissingMemberHandling.Error
+ });
}
var dateTimeOffset = DateTimeOffset.Now;
var logData = _binaryLogProcessor.ProcessLog(inputFile, cloneRoot, owner, repo, hash, configuration);
var hasAnyFailure = logData.Annotations.Any() &&
- logData.Annotations.Any(annotation => annotation.CheckWarningLevel == CheckWarningLevel.Failure);
+ logData.Annotations.Any(annotation => annotation.AnnotationLevel == AnnotationLevel.Failure);
var stringBuilder = new StringBuilder();
stringBuilder.Append(logData.ErrorCount.ToString());