public void Reset() { defectCountBeforeCheck = 0; Defects.Clear(); SeverityBitmask.SetAll(); ConfidenceBitmask.SetAll(); }
bool ParseConfidence(string filter) { ConfidenceBitmask.ClearAll(); foreach (string option in SplitOptions(filter)) { Confidence confidence; switch (option) { case "LOW": case "LOW+": case "LOW-": confidence = Confidence.Low; break; case "NORMAL": case "NORMAL+": case "NORMAL-": confidence = Confidence.Normal; break; case "HIGH": case "HIGH+": case "HIGH-": confidence = Confidence.High; break; case "TOTAL": case "TOTAL+": case "TOTAL-": confidence = Confidence.Total; break; case "ALL": case "*": ConfidenceBitmask.SetAll(); continue; default: string msg = String.Format(CultureInfo.CurrentCulture, "Unknown confidence level '{0}'", option); throw new OptionException(msg, "confidence"); } char end = option [option.Length - 1]; if (end == '+') { ConfidenceBitmask.SetDown(confidence); } else if (end == '-') { ConfidenceBitmask.SetUp(confidence); } else { ConfidenceBitmask.Set(confidence); } } return(true); }
byte Parse(string [] args) { bool severity = false; bool confidence = false; // if supplied, use the user limit on defects (otherwise 2^31 is used) DefectsLimit = Int32.MaxValue; var p = new OptionSet() { { "config=", v => config_file = ValidateInputFile("config", v) }, { "set=", v => rule_set = ValidateRuleSet(v) }, { "log=", v => log_file = ValidateOutputFile("log", v) }, { "xml=", v => xml_file = ValidateOutputFile("xml", v) }, { "html=", v => html_file = ValidateOutputFile("html", v) }, { "ignore=", v => ignore_file = ValidateInputFile("ignore", v) }, { "limit=", v => DefectsLimit = ValidateLimit(v) }, { "severity=", v => severity = ParseSeverity(v) }, { "confidence=", v => confidence = ParseConfidence(v) }, { "v|verbose", v => ++ VerbosityLevel }, { "console", v => console = v != null }, { "quiet", v => quiet = v != null }, { "version", v => version = v != null }, { "h|?|help", v => help = v != null }, }; try { assembly_names = p.Parse(args); } catch (OptionException e) { Console.WriteLine("Error parsing option '{0}' : {1}", e.OptionName, e.Message); Console.WriteLine(); return(1); } // by default the runner will ignore Audit and Low severity defects if (!severity) { SeverityBitmask.SetAll(); SeverityBitmask.Clear(Severity.Audit); SeverityBitmask.Clear(Severity.Low); } // by default the runner will ignore Low confidence defects if (!confidence) { ConfidenceBitmask.SetAll(); ConfidenceBitmask.Clear(Confidence.Low); } return((byte)((assembly_names.Count > 0) ? 0 : 1)); }