// Copyright Epic Games, Inc. All Rights Reserved. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Tools.DotNETCommon.Perforce; namespace BuildAgent.Issues.Matchers { /// /// Base class for pattern matchers that match errors in source code /// abstract class GenericCodeIssueMatcher : Matcher { /// /// Set of extensions to treat as code /// static readonly string[] CodeExtensions = { ".c", ".cc", ".cpp", ".m", ".mm", ".rc", ".cs", ".h", ".hpp", ".inl", ".uproject", ".uplugin", ".ini", }; /// /// Finds any suspected causers for a particular failure. Excludes any changes that don't contain code. /// /// The perforce connection /// The build issue /// List of changes since the issue first occurred. /// List of changes which are causers for the issue public override List FindCausers(PerforceConnection Perforce, Issue Issue, IReadOnlyList Changes) { List Causers = base.FindCausers(Perforce, Issue, Changes); Causers.RemoveAll(x => !ContainsAnyFileWithExtension(Perforce, x, CodeExtensions)); return Causers; } } }