public void Add(Violation violation)
 {
     isHappy = false;
     myViolations.Add(violation);
 }
 public void AddViolation(Violation violation)
 {
     violations.Add(violation);
 }
 public Results CheckFile(string fileName)
 {
     Results results;
     try {
         using (Stream file = File.Open(fileName, FileMode.Open)) {
             results = Check(file, fileName);
         }
     } catch (FileNotFoundException exception) {
         results = new Results(fileName);
         Violation violation = new Violation(ViolationType.FileNotFound, exception.Message, Constants.NO_LINE, fileName);
         results.Add(violation);
     }
     return results;
 }
 protected override void Clear()
 {
     if (delayViolation != null) {
         if (!IsInitializingTheBaseClass()) {
             violations.Add(delayViolation);
         }
         delayViolation = null;
     }
     if (parensLevel > 0 || !tailChars.Contains(LastCharacter)) {
         delayViolation = OneLinePerStatement();
         if (')' != LastCharacter) {
             violations.Add(delayViolation);
             delayViolation = null;
         }
     }
     firstCharacterInLine = Constants.ASCII_CR;
 }
 private void VariableTooShort()
 {
     string message = "Identifier '{0}' is too short: {1} characters";
     message = string.Format(CultureInfo.InvariantCulture, message, currentWord, wordLenght);
     string currentLine = Context.CurrentLine;
     Violation violation = new Violation(ViolationType.VariableTooShort, message, Context.FileLenght, currentLine);
     Context.AddViolation(violation);
 }
 protected override void DoNewLine(Context context)
 {
     if (delayViolation != null) {
         if (!context.IsInitializingTheBaseClass(firstCharacterInLine)) {
             context.AddViolation(delayViolation);
         }
         delayViolation = null;
     }
     if ((ParensLevel > 0 || !tailChars.Contains(context.LastCharacter))) {
         delayViolation = OneLinePerStatement();
         if (')' != context.LastCharacter) {
             if (!(']' == context.LastCharacter && isInAttribute)) {
                 context.AddViolation(delayViolation);
             }
             delayViolation = null;
         }
     }
     firstCharacterInLine = Constants.ASCII_CR;
 }