Package org.sonar.squidbridge.api

Examples of org.sonar.squidbridge.api.SourceFile


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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/octalNumber.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(2).withMessage("Replace the value of the octal number (00) by its decimal equivalent (0).")
        .next().atLine(3).withMessage("Replace the value of the octal number (0644) by its decimal equivalent (420).")
        .noMore();
  }
View Full Code Here


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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/functionCreationInsideLoop.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(4).withMessage("Define this function outside of a loop.")
        .next().atLine(12)
        .next().atLine(23)
        .noMore();
  }
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/forIn.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(1).withMessage("Insert an if statement at the beginning of this loop to filter items.")
        .noMore();
  }
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/bitwiseOperators.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(2).withMessage("Remove the use of \"~\" operator.")
        .next().atLine(3)
        .next().atLine(4)
        .next().atLine(5)
        .next().atLine(6)
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/parentheses.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(2).withMessage("Those parentheses are useless.")
        .next().atLine(8)
        .next().atLine(12)
        .next().atLine(15)
        .next().atLine(23)
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/eqEqEq.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(2).withMessage("Replace \"==\" with \"===\".")
        .next().atLine(4).withMessage("Replace \"!=\" with \"!==\".")
        .noMore();
  }
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/inlineConditional.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(2).withMessage("Replace this conditional operator by a standard if/else control flow statement.")
        .noMore();
  }
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/elseIfWithoutElse.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(15).withMessage("Add the missing \"else\" clause.")
        .noMore();
  }
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/unusedFunctionArgument.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
      .next().atLine(1).withMessage("Remove the unused function parameter \"b\".")
      .next().atLine(5).withMessage("Remove the unused function parameters \"b, c\".")
      .next().atLine(9).withMessage("Remove the unused function parameter \"p1\".")
      .next().atLine(12).withMessage("Remove the unused function parameter \"c\".")
      .next().atLine(16)
View Full Code Here

  MissingNewlineAtEndOfFileCheck check = new MissingNewlineAtEndOfFileCheck();

  @Test
  public void test() {
    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/newlineAtEndOfFile.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next()
        .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.