From 665a062a5d5931fb947ebd237672fd6e358d710e Mon Sep 17 00:00:00 2001 From: snowbagoly Date: Thu, 12 Dec 2024 18:38:58 +0100 Subject: [PATCH] TS-41003 Fix findings --- BummerExe/Program.cs | 26 +------------------ BummerLib/MethodMapper/Pdb/PdbFile.cs | 4 +-- BummerLib/MethodMapper/Pdb/PdbMethodMapper.cs | 2 +- BummerLib_Test/TestBase.cs | 6 +++++ 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/BummerExe/Program.cs b/BummerExe/Program.cs index 3da18c6d..6a997e29 100644 --- a/BummerExe/Program.cs +++ b/BummerExe/Program.cs @@ -19,10 +19,8 @@ using System; using System.Collections.Generic; -using System.IO; using Fclp; using Newtonsoft.Json; -using System.Linq; namespace Cqse.ConQAT.Dotnet.Bummer { @@ -65,7 +63,7 @@ public static int Main(string[] args) } if (!commandLineParseResult.HasErrors) { - List methodMappings = GetMethodMappings(filenames, assemblyNames); + List methodMappings = Bummer.GetMethodMappings(filenames, assemblyNames); OutputMethodMappings(methodMappings); } else @@ -76,28 +74,6 @@ public static int Main(string[] args) return 0; } - /// - /// Gets the method mappings for the specified list of file names. - /// - /// The list of symbol filenames to analyze. - private static List GetMethodMappings(List filenames, List assemblyNames) - { - var methodMappings = new List(); - var methodMapper = new MethodMapper(); - // TODO (FS) please don't use 1-letter variable names - foreach (var pair in filenames.Zip(assemblyNames, (f, s) => new { filename = f, assemblyName = s })) - { - if (!File.Exists(pair.filename)) - { - Console.WriteLine("File does not exist: " + pair.filename); - continue; - } - - methodMappings.Add(methodMapper.GetMethodMappings(pair.filename, pair.assemblyName)); - } - return methodMappings; - } - /// /// Prints the specified list of method mappings on the console as JSON. /// diff --git a/BummerLib/MethodMapper/Pdb/PdbFile.cs b/BummerLib/MethodMapper/Pdb/PdbFile.cs index b1127a8f..0a42b676 100644 --- a/BummerLib/MethodMapper/Pdb/PdbFile.cs +++ b/BummerLib/MethodMapper/Pdb/PdbFile.cs @@ -168,11 +168,11 @@ public static IEnumerable LoadPdbFunctions(Stream pdbStream) { Dictionary tokenToSourceMapping = null; string sourceServerData = null; - const int Age = 0; + const int age = 0; Guid guid = Guid.Empty; object loadedPdbFunctions = PdbFileLoadFunctionsMethodInfo - .Invoke(null, new object[] { pdbStream, tokenToSourceMapping, sourceServerData, Age, guid }); + .Invoke(null, new object[] { pdbStream, tokenToSourceMapping, sourceServerData, age, guid }); foreach (object pdbFunction in loadedPdbFunctions as Array) { diff --git a/BummerLib/MethodMapper/Pdb/PdbMethodMapper.cs b/BummerLib/MethodMapper/Pdb/PdbMethodMapper.cs index 992e808b..e9f8cb30 100644 --- a/BummerLib/MethodMapper/Pdb/PdbMethodMapper.cs +++ b/BummerLib/MethodMapper/Pdb/PdbMethodMapper.cs @@ -139,7 +139,7 @@ private static string DetectPdbType(string pdbFile) foreach (string magicString in MagicTypes) { - if (magicString.Zip(magicBytes, (magicChar, magicByte) => magicChar == magicByte).All(result => result == true)) + if (magicString.Zip(magicBytes, (magicChar, magicByte) => magicChar == magicByte).All(result => result)) { return magicString; } diff --git a/BummerLib_Test/TestBase.cs b/BummerLib_Test/TestBase.cs index 66984d92..f7933823 100644 --- a/BummerLib_Test/TestBase.cs +++ b/BummerLib_Test/TestBase.cs @@ -23,8 +23,14 @@ namespace Cqse.ConQAT.Dotnet.Bummer { + /// + /// Test base class for Bummer tests + /// public class TestBase { + /// + /// Returns the FileInfo for a resource file in the TestData folder. + /// protected FileInfo GetGlobalTestFile(string resource) { string path = Path.Combine(TestContext.CurrentContext.TestDirectory, "../..", "TestData", resource); return new FileInfo(path);