private void LogResult(ILogDispatcher logger, IHelixAnalyzer helixAnalyzer, IAnalyzeResult analyzeResult) { logger.InitLogger(helixAnalyzer.Name, ""); foreach (var result in analyzeResult.Results) { logger.Log(result.Message, result.Result.ToLogLevel()); } }
public int GetExitCodePolicy(IAnalyzeResult result) { if (result.Results.Any(p => p.Result == RuleResult.Fail)) { return(GetPolicyResult(RuleResult.Fail)); } return(result.Results.Any(p => p.Result == RuleResult.Warning) ? GetPolicyResult(RuleResult.Warning) : 0); }
public int CompareTo(IAnalyzeResult other) { if (!(other is DuplicateResult)) { throw new Exception("DuplicateResult can be comoparable only with another DuplicateResult"); } var otherDuplicateResult = other as DuplicateResult; if (LinesCount < otherDuplicateResult.LinesCount) { return(-1); } if (LinesCount > otherDuplicateResult.LinesCount) { return(1); } if (GetUnitsCount() < otherDuplicateResult.GetUnitsCount()) { return(-1); } if (GetUnitsCount() > otherDuplicateResult.GetUnitsCount()) { return(1); } for (int i = 0; i < GetUnitsCount(); i++) { int compareFileNamesResult = String.Compare(GetUnit(i).FileName, otherDuplicateResult.GetUnit(i).FileName, StringComparison.Ordinal); if (compareFileNamesResult != 0) { return(compareFileNamesResult); } if (GetUnit(i).LineNumber < otherDuplicateResult.GetUnit(i).LineNumber) { return(-1); } if (GetUnit(i).LineNumber > otherDuplicateResult.GetUnit(i).LineNumber) { return(1); } } return(0); }