Пример #1
0
 private void LineTooWide(Context context)
 {
     string viewLine = context.CurrentLine.Replace(' ', '.');
     string message = "This line is too wide: {0} instead of {1}";
     message = string.Format(CultureInfo.InvariantCulture, message, charactersInLine, maxCharacters);
     context.AddViolation(new Violation(ViolationType.LineTooWide, message, context.FileLenght, viewLine));
 }
Пример #2
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;
 }
Пример #3
0
 protected override void DoNewLine(Context context)
 {
     int resultCommas = commas - (context.LastCharacter == ',' ? 1 : 0);
     if (resultCommas > 0 || semiColumns > 1) {
         context.AddViolation(OneStatementPerLine());
     }
     semiColumns = 0;
     commas = 0;
     isInterfaceDef = false;
 }
Пример #4
0
 public override void Close(Context context)
 {
     if (Constants.ALLOWABLE_LINES_PER_FILE < myCodeLenght) {
         context.AddViolation(CompilationUnitTooLong());
     }
 }