public override FunctionStateContext Check(bool threshold) { var stateContext = new FunctionStateContext(); var debugMode = codeAnalysisTool.GetDebugMode(); if (debugMode == threshold) { stateContext.SetState(new Harmless()); } else { stateContext.SetState(new Toxic()); } return(stateContext); }
public override FunctionStateContext Check(int threshold) { var stateContext = new FunctionStateContext(); var codeComplexityRating = codeAnalysisTool.GetCodeComplexityRating(); if (IsRatingGreatherThreshold(threshold, codeComplexityRating)) { stateContext.SetState(new Toxic()); } else if (IsRatingLessThanThreshold(threshold, codeComplexityRating)) { stateContext.SetState(new Harmless()); } else { stateContext.SetState(new Warning()); } return(stateContext); }
public override FunctionStateContext Check(int threshold) { var stateContext = new FunctionStateContext(); var classCount = codeAnalysisTool.GetClassCountOverMaxNumberOfLinesAllowed(maxNumberOfLinesAllowed); if (IsClassCountLessThanThreshold(threshold, classCount)) { stateContext.SetState(new Harmless()); } else if (IsClassCountGreaterThanThreshold(threshold, classCount)) { stateContext.SetState(new Toxic()); } else { stateContext.SetState(new Warning()); } return(stateContext); }