Package org.sonar.squidbridge.api

Examples of org.sonar.squidbridge.api.SourceFile


  @Test
  public void test() {
    TrailingCommaCheck check = new TrailingCommaCheck();

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/trailingComma.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(1).withMessage("Avoid trailing comma in array and object literals.")
        .next().atLine(4).withMessage("Avoid trailing comma in array and object literals.")
        .noMore();
  }
View Full Code Here


  private NonCaseLabelInSwitchCheck check = new NonCaseLabelInSwitchCheck();

  @Test
  public void test() {
    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/nonCaseLabelInSwitch.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
      .next().atLine(4).withMessage("Remove this misleading \"case2\" label.")
      .next().atLine(13)
      .next().atLine(23)
      .noMore();
  }
View Full Code Here

  @Test
  public void test() {
    MultilineStringLiteralsCheck check = new MultilineStringLiteralsCheck();

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/multilineStringLiteral.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(2).withMessage("Use string concatenation rather than line continuation.")
        .noMore();
  }
View Full Code Here

  private ReturnOfBooleanExpressionCheck check = new ReturnOfBooleanExpressionCheck();

  @Test
  public void test() {
    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/returnOfBooleanExpression.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
      .next().atLine(3).withMessage("Replace this if-then-else statement by a single return statement.")
      .next().atLine(9)
      .next().atLine(15)
      .noMore();
  }
View Full Code Here

  @Test
  public void test() {
    SemicolonCheck check = new SemicolonCheck();

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/semicolon.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(2).withMessage("Add a semicolon at the end of this statement.")
        .next().atLine(7)
        .noMore();
  }
View Full Code Here

  @Test
  public void test() {
    TrailingWhitespaceCheck check = new TrailingWhitespaceCheck();

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/trailingWhitespace.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(3).withMessage("Remove the useless trailing whitespaces at the end of this line.")
        .noMore();
  }
View Full Code Here

  TabCharacterCheck check = new TabCharacterCheck();

  @Test
  public void test() {
    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/tabCharacter.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(1).withMessage("Replace all tab characters in this file by sequences of white-spaces.")
        .noMore();
  }
View Full Code Here

        .noMore();
  }

  @Test
  public void test2() {
    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/newlineAtEndOfFile.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .noMore();
  }
View Full Code Here

  private AlertUseCheck check = new AlertUseCheck();

  @Test
  public void test() {
    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/AlertUse.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
    .next().atLine(1)
    .next().atLine(8)
    .noMore();

  }
View Full Code Here

  @Test
  public void test() {
    EmptyBlockCheck check = new EmptyBlockCheck();

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/emptyBlock.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(2).withMessage("Either remove or fill this block of code.")
        .next().atLine(16).withMessage("Either remove or fill this block of code.")
        .noMore();
  }
View Full Code Here

TOP

Related Classes of org.sonar.squidbridge.api.SourceFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.