public static Result BuildResult(ResultLevel level, IAnalysisContext context, Region region, string formatId, params string[] arguments)
{
//validating parameters
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
if (arguments == null)
{
throw new ArgumentNullException(nameof(arguments));
}
formatId = RuleUtilities.NormalizeFormatId(context.Rule.Id, formatId);
Result result = new Result
{
RuleId = context.Rule.Id,
FormattedRuleMessage = new FormattedRuleMessage()
{
FormatId = formatId,
Arguments = arguments
},
Level = level
};
string targetPath = context.TargetUri?.LocalPath;
if (targetPath != null)
{
result.Locations = new List<Location> {
new Sarif.Location {
AnalysisTarget = new PhysicalLocation
{
Uri = new Uri(targetPath),
Region = region
}
}};
}
return result;
}