public Script ValidateScriptAgainstPolicies(string scriptName, string scriptGuid, string scriptText, string targetDatabase, int commentDayThreshold) { Script violations = new Script(scriptName, scriptGuid); List <p.IScriptPolicy> policies = GetPolicies(); foreach (p.IScriptPolicy policy in policies) { if (policy is CommentHeaderPolicy) { ((CommentHeaderPolicy)policy).DayThreshold = commentDayThreshold; } Violation tmp = ValidateScriptAgainstPolicy(scriptText, targetDatabase, policy); if (tmp != null) { violations.AddViolation(tmp); } } if (violations.Count > 0) { return(violations); } else { return(null); } }
public void AddViolation(Violation item) { this.violations.Add(item); }