‘On Detection’ blocks

You can define logic that is executed whenever a detection is found. this can be used to generate fix suggestions and automated patches. For example

rule DeprecatedAnnotation on ApexClass {

		// for every annotation
    on annotation(x) {

			 if (x.text .= "deprecated") {
					capture(x)
			 }

    }

		autofix(detection) {
				Autofix.remove(x) // removes the annotation
		}

}