コード例 #1
0
 public void Add(Violation violation)
 {
     isHappy = false;
     myViolations.Add(violation);
 }
コード例 #2
0
 public void AddViolation(Violation violation)
 {
     violations.Add(violation);
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 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);
 }
コード例 #6
0
 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;
 }