An entry point is a syntax rule. A syntax rule operates on the AST (abstract syntax tree) of source files.
rule MyRule on ApexPage, ApexComponent {
on element(x) {
// executed when a node of type "element" is found in the AST
}
on content(x) {
// executed when a node of type "content" is found in the AST
}
autofix(detection) {
// This is executed for every detection captured
}
}
This syntax rule specifies:
ApexPage
and ApexComponent
Variables can be declared with the keyword var
then assigning an expression to it.
var st = "Lorem Ipsum" // string variable
var num = 23 // numeric variable
var bool = true // boolean
If statements allow to execute a block of statements only when certain conditions are verified.
if (st == "abc") {
// if true do this
}
Optionally, if statements can have an else
block
if (st == "abc") {
// if true do this
} else {
// otherwise do this
}
To stay safe from errors, you can use try statements
try {
doSomethingDangerous()
}