internal static string GetExpectedErrorLogHeader(CommonCompiler compiler) { var expectedToolName = compiler.GetToolName(); var expectedVersion = compiler.GetAssemblyVersion(); var expectedSemanticVersion = compiler.GetAssemblyVersion().ToString(fieldCount: 3); var expectedFileVersion = compiler.GetCompilerVersion(); var expectedLanguage = compiler.GetCultureName(); return(string.Format( @"{{ ""$schema"": ""http://json.schemastore.org/sarif-1.0.0"", ""version"": ""1.0.0"", ""runs"": [ {{ ""tool"": {{ ""name"": ""{0}"", ""version"": ""{1}"", ""fileVersion"": ""{2}"", ""semanticVersion"": ""{3}"", ""language"": ""{4}"" }},", expectedToolName, expectedVersion, expectedFileVersion, expectedSemanticVersion, expectedLanguage )); }
internal static string GetExpectedErrorLogHeader(string actualOutput, CommonCompiler compiler) { var expectedToolName = compiler.GetToolName(); var expectedProductVersion = compiler.GetAssemblyVersion().ToString(fieldCount: 3); var fileVersion = compiler.GetAssemblyFileVersion(); var expectedFileVersion = fileVersion.Substring(0, fileVersion.LastIndexOf('.')); return(string.Format(@"{{ ""version"": ""{0}"", ""toolInfo"": {{ ""toolName"": ""{1}"", ""productVersion"": ""{2}"", ""fileVersion"": ""{3}"" }},", ErrorLogger.OutputFormatVersion, expectedToolName, expectedProductVersion, expectedFileVersion)); }