Package org.sonar.squidbridge.api

Examples of org.sonar.squidbridge.api.SourceFile


    CommentRegularExpressionCheck check = new CommentRegularExpressionCheck();

    check.regularExpression = "(?i).*TODO.*";
    check.message = "Avoid TODO";

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/commentRegularExpression.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(2).withMessage("Avoid TODO")
        .noMore();
  }
View Full Code Here


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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/duplicatePropertyName.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(5).withMessage("Rename or remove duplicate property name 'key'.")
        .next().atLine(6).withMessage("Rename or remove duplicate property name 'key'.")
        .next().atLine(7).withMessage("Rename or remove duplicate property name 'key'.")
        .next().atLine(8).withMessage("Rename or remove duplicate property name '\\u006bey'.")
        .next().atLine(9).withMessage("Rename or remove duplicate property name '\\u006bey'.")
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/primitiveWrappers.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(2).withMessage("Do not use wrapper objects for primitive types.")
        .next().atLine(12)
        .next().atLine(13)
        .noMore();
  }
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/strictMode.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(1).withMessage("Use of JavaScript strict mode may result in unexpected behaviour in some browsers.")
        .next().atLine(2)
        .noMore();
  }
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/strictMode.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(1).withMessage("Use of JavaScript strict mode may result in unexpected behaviour in some browsers.")
        .next().atLine(2)
        .noMore();
  }
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/withStatement.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(2).withMessage("Remove this use of \"with\".")
        .noMore();
  }
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/assignmentWithinCondition.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(1).withMessage("Extract the assignment out of this expression.")
        .next().atLine(4)
        .next().atLine(16)
        .next().atLine(23)
        .next().atLine(28)
View Full Code Here

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

    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/continueStatement.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(6).withMessage("Avoid using continue statement.")
        .noMore();
  }
View Full Code Here

  private ExcessiveParameterListCheck check = new ExcessiveParameterListCheck();

  @Test
  public void defaults() {
    SourceFile file = JavaScriptAstScanner.scanSingleFile(new File("src/test/resources/checks/excessiveParameterList.js"), check);
    CheckMessagesVerifier.verify(file.getCheckMessages())
        .next().atLine(4).withMessage("Function has 8 parameters which is greater than 7 authorized.")
        .next().atLine(7)
        .noMore();
  }
View Full Code Here

  }

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