public class SeCheck extends Object implements JavaScriptCheck
| Constructor and Description |
|---|
SeCheck() |
| Modifier and Type | Method and Description |
|---|---|
<T extends Issue> |
addIssue(T issue)
Use this method only to add specific kind of issue.
|
PreciseIssue |
addIssue(Tree tree,
String message)
Returns new issue which is instance of
PreciseIssue. |
LineIssue |
addLineIssue(Tree tree,
String message)
Deprecated.
|
void |
afterBlockElement(ProgramState currentState,
Tree element)
Override this method to perform actions after executing
element. |
void |
beforeBlockElement(ProgramState currentState,
Tree element,
ProgramPoint programPoint)
Override this method to perform actions before executing
element. |
void |
checkConditions(Map<Tree,Collection<Constraint>> conditions)
Override this method to check the constraints on conditions (TRUTHY or FALSY) in current execution (aka function scope).
|
void |
endOfExecution(Scope functionScope)
Override this method to perform actions when the execution is finished.
|
void |
endOfFile(ScriptTree scriptTree) |
TreeVisitorContext |
getContext() |
List<Issue> |
scanFile(TreeVisitorContext context) |
void |
setContext(TreeVisitorContext context) |
void |
startOfExecution(Scope functionScope)
Override this method to perform actions before the start of execution.
|
void |
startOfFile(ScriptTree scriptTree) |
String |
toString() |
public void checkConditions(Map<Tree,Collection<Constraint>> conditions)
public void beforeBlockElement(ProgramState currentState, Tree element, ProgramPoint programPoint)
element.
This method is called before each element until end of execution or reaching the execution limit.currentState - current state at the program point preceding elementelement - syntax tree to be executed nextprogramPoint - current programPoint associated to the elementpublic void afterBlockElement(ProgramState currentState, Tree element)
element.
This method is called after each element until end of execution or reaching the execution limit.currentState - current state at the program point following elementelement - last executed syntax treepublic void startOfFile(ScriptTree scriptTree)
public void endOfFile(ScriptTree scriptTree)
public void endOfExecution(Scope functionScope)
functionScope - scope corresponding to the function which was executedpublic void startOfExecution(Scope functionScope)
functionScope - scope corresponding to the function which will be executed@Deprecated public LineIssue addLineIssue(Tree tree, String message)
JavaScriptCheck.addLineIssue(Tree, String)JavaScriptChecktreeaddLineIssue in interface JavaScriptCheckpublic PreciseIssue addIssue(Tree tree, String message)
JavaScriptCheckPreciseIssue. Then you can chain this method with following method calls to provide more information about issue:
PreciseIssue.secondary(Tree, String), PreciseIssue.secondary(Tree) (without message) or
PreciseIssue.secondary(IssueLocation) to add secondary locationPreciseIssue.cost(double) to add costSee example
newIssue(functionDeclaration, "Remove this function declaration")
.secondary(call, "Function call")
.secondary(redefinition, "Function redefinition")
.cost(functionDeclaration.parameters().parameters().size());
To create new issue you also can use JavaScriptCheck.addIssue(Issue): getContext().addIssue(new FileIssue(this, "Some message"))
addIssue in interface JavaScriptChecktree - primary location of issuemessage - primary messagepublic <T extends Issue> T addIssue(T issue)
JavaScriptCheck
Otherwise please use JavaScriptCheck.addIssue(Tree, String)
addIssue in interface JavaScriptCheckpublic List<Issue> scanFile(TreeVisitorContext context)
scanFile in interface JavaScriptCheckpublic void setContext(TreeVisitorContext context)
public TreeVisitorContext getContext()
Copyright © 2011–2017 SonarSource and Eriks Nukis. All rights reserved.