Package io.codemodder

Class SarifPluginJavaParserChanger<T extends com.github.javaparser.ast.Node>

java.lang.Object
io.codemodder.javaparser.JavaParserChanger
io.codemodder.SarifPluginJavaParserChanger<T>
All Implemented Interfaces:
CodeChanger

public abstract class SarifPluginJavaParserChanger<T extends com.github.javaparser.ast.Node> extends JavaParserChanger
Provides base functionality for making JavaParser-based changes based on results found by a sarif file.
  • Field Details

  • Constructor Details

  • Method Details

    • visit

      public CodemodFileScanningResult visit(CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu)
      Description copied from class: JavaParserChanger
      Called when a Java file, which has already been parsed into a compilation unit, is seen.
      Specified by:
      visit in class JavaParserChanger
    • shouldRun

      public boolean shouldRun()
      Description copied from interface: CodeChanger
      A lifecycle event that is called before any files are processed. This is a good place to short circuit if you don't have the necessary resources (e.g., SARIF).
    • onResultFound

      public abstract ChangesResult onResultFound(CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu, T node, com.contrastsecurity.sarif.Result result)
      Creates a visitor for the given context and locations.
      Parameters:
      context - the context of this files transformation
      cu - the parsed model of the file being transformed
      node - the node to act on
      result - the given SARIF result to act on
      Returns:
      ChangesResult, that contains result changes