public void MethodFailed(MethodDefinition method, string checkID, int offset, string details) { if (!method.CustomAttributes.HasDisableRule(checkID)) { Location location = m_cache.Symbols.Location(method, offset, details); Violation violation = ViolationDatabase.Get(checkID); m_errors.Add(new Error(location, violation)); } }
public void AssemblyFailed(AssemblyDefinition assembly, string checkID, string details) { if (assembly == null || !assembly.CustomAttributes.HasDisableRule(checkID)) { Location loc = new Location(); loc.Name = assembly != null?string.Format("Assembly: {0}", assembly.Name.Name) : string.Empty; loc.Line = -1; loc.Offset = -1; loc.Details = details; Violation violation = ViolationDatabase.Get(checkID); m_errors.Add(new Error(loc, violation)); } }
public void TypeFailed(TypeDefinition type, string checkID, string details) { if (!type.CustomAttributes.HasDisableRule(checkID)) { DBC.Assert(m_cache != null, "m_cache is null"); DBC.Assert(m_cache.Symbols != null, "m_cache.Symbols is null"); DBC.Assert(type != null, "type is null"); DBC.Assert(details != null, "details is null"); Location location = m_cache.Symbols.Location(type, details); Violation violation = ViolationDatabase.Get(checkID); DBC.Assert(violation != null, "violation is null"); DBC.Assert(m_errors != null, "m_errors is null"); m_errors.Add(new Error(location, violation)); } }
// Don't bother with a rule if the user doesn't care about rules of that // severity or he's excluded the rule. private bool DoRuleRequiresCheck(string checkID, Severity severity, bool ignoreBreaks) { Violation violation = ViolationDatabase.Get(checkID); if (violation.Severity > severity) { return(false); } if (ignoreBreaks && violation.Breaking) { return(false); } if (m_excludedChecks.Contains(checkID)) { return(false); } return(true); }