Skip to content

Commit

Permalink
TS-41003 Fix findings
Browse files Browse the repository at this point in the history
  • Loading branch information
snowbagoly committed Dec 12, 2024
1 parent 843e596 commit 665a062
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 28 deletions.
26 changes: 1 addition & 25 deletions BummerExe/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -65,7 +63,7 @@ public static int Main(string[] args)
}
if (!commandLineParseResult.HasErrors)
{
List<AssemblyMethodMappings> methodMappings = GetMethodMappings(filenames, assemblyNames);
List<AssemblyMethodMappings> methodMappings = Bummer.GetMethodMappings(filenames, assemblyNames);
OutputMethodMappings(methodMappings);
}
else
Expand All @@ -76,28 +74,6 @@ public static int Main(string[] args)
return 0;
}

/// <summary>
/// Gets the method mappings for the specified list of file names.
/// </summary>
/// <param name="filenames">The list of symbol filenames to analyze.</param>
private static List<AssemblyMethodMappings> GetMethodMappings(List<string> filenames, List<string> assemblyNames)
{
var methodMappings = new List<AssemblyMethodMappings>();
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;
}

/// <summary>
/// Prints the specified list of method mappings on the console as JSON.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions BummerLib/MethodMapper/Pdb/PdbFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ public static IEnumerable<PdbFunction> LoadPdbFunctions(Stream pdbStream)
{
Dictionary<uint, object> 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)
{
Expand Down
2 changes: 1 addition & 1 deletion BummerLib/MethodMapper/Pdb/PdbMethodMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions BummerLib_Test/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@

namespace Cqse.ConQAT.Dotnet.Bummer
{
/// <summary>
/// Test base class for Bummer tests
/// </summary>
public class TestBase
{
/// <summary>
/// Returns the FileInfo for a resource file in the TestData folder.
/// </summary>
protected FileInfo GetGlobalTestFile(string resource) {
string path = Path.Combine(TestContext.CurrentContext.TestDirectory, "../..", "TestData", resource);
return new FileInfo(path);
Expand Down

0 comments on commit 665a062

Please sign in to comment.