public static async Task <HashSet <RuleUsage> > ResolveAsync(IEnumerable <RawRuleUsage> rawUsageData) { var allRules = await GetAllRulesAsync(); var result = new HashSet <RuleUsage>(); foreach (var dataPoint in rawUsageData) { var selector = StandardizeSelector(dataPoint.Selector); var locations = new HashSet <SourceLocation>(dataPoint.SourceLocations.Where(x => x != null)); foreach (var match in allRules.Where(x => x.IsMatch(selector))) { var ruleUsage = new RuleUsage { Rule = match }; ruleUsage.SourceLocations.UnionWith(locations); result.Add(ruleUsage); } } return(result); }
internal static HashSet <RuleUsage> Resolve(IEnumerable <RawRuleUsage> rawUsageData) { var allRules = AmbientRuleContext.GetAllRules(); var result = new HashSet <RuleUsage>(); foreach (var dataPoint in rawUsageData) { var selector = StandardizeSelector(dataPoint.Selector); var locations = new HashSet <SourceLocation>(dataPoint.SourceLocations.Where(x => x != null)); foreach (var match in allRules.Where(x => x.IsMatch(selector))) { var ruleUsage = new RuleUsage { Rule = match }; ruleUsage.SourceLocations.UnionWith(locations); result.Add(ruleUsage); } } return(result); }