public override void Check(char currentCharacter, Context context)
 {
     context.DoSetup(currentCharacter);
     base.Check(currentCharacter, context);
     context.DoTeardown(currentCharacter);
 }
 protected void SetUp()
 {
     ruleChecker = new WidthRule();
     results = new Results(TEST_FILENAME);
     context = new Context();
 }
 protected void TearDown()
 {
     ruleChecker = null;
     results = null;
     context = null;
 }
 protected void SetUp()
 {
     context = new Context();
     lineChecker = new TestCheckerMockLine();
 }
 protected void TearDown()
 {
     context = null;
     lineChecker = null;
 }
예제 #6
0
 protected abstract void DoNewLine(Context context);
예제 #7
0
 public virtual void Check(char currentCharacter, Context context)
 {
     this.myContext = context;
     myChain.Execute(currentCharacter);
 }
예제 #8
0
 protected override void DoNewLine(Context context)
 {
     HandleNewWord(Constants.ASCII_LF);
 }
예제 #9
0
 protected override void DoNewLine(Context context)
 {
     if (maxCharacters < charactersInLine) {
         LineTooWide(context);
     }
     charactersInLine = 0;
     lineStart = true;
 }
예제 #10
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;
 }
예제 #11
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;
 }
예제 #12
0
 protected override void DoNewLine(Context context)
 {
     if (inMethod) {
         bool countIt = (context.TotallyEmptyLine || (iHaveCode && !context.IAmInComment));
         if (countIt) {
             myMethodLength++;
         }
     } else {
         if (context.LastCharacter == '{' && methodEnter && methodExit && ParensLevel == 0) {
             inMethod = true;
             myMethodReentranceStart = myReentrance;
             originalMethodLine = Context.CurrentLine;
         }
     }
     methodEnter = false;
     methodExit = false;
     iHaveCode = false;
 }
예제 #13
0
 protected override void DoNewLine(Context context)
 {
     bool countIt = context.TotallyEmptyLine || iHaveCode;
     if (countIt) {
         myCodeLenght++;
     }
     iHaveCode = false;
 }
예제 #14
0
 public override void Close(Context context)
 {
     if (Constants.ALLOWABLE_LINES_PER_FILE < myCodeLenght) {
         context.AddViolation(CompilationUnitTooLong());
     }
 }
 public override void Close(Context context)
 {
     base.Close(context);
 }
예제 #16
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));
 }
 private void InitializeRuleset()
 {
     context = new Context();
 }
예제 #18
0
 public virtual void Close(Context context)
 {
     DoNewLine(context);
 }