Package io.codemodder

Interface CodemodProvider


public interface CodemodProvider
A type that helps provide functionality codemods. For instance, we may have providers that run SAST tools, help codemods understand build files, dependency management, etc.
  • Method Details

    • getModules

      Set<com.google.inject.AbstractModule> getModules(Path repository, List<Path> includedFiles, List<String> pathIncludes, List<String> pathExcludes, List<Class<? extends CodeChanger>> codemodTypes, List<RuleSarif> sarifs, List<Path> sonarIssuesJsonPaths, Path defectDojoFindingsJsonPath, Path contrastFindingsJsonPath)
      Return a set of Guice modules that allow dependency injection
      Parameters:
      repository - the repository root
      includedFiles - the files that qualify for inclusion based on the patterns provided
      pathIncludes - the path includes provided to the CLI (which could inform the providers on their own analysis)
      pathExcludes - the path excludes provided to the CLI (which could inform the providers on their own analysis)
      codemodTypes - the codemod types that are being run
      sarifs - the SARIF output of tools that are being run
      sonarIssuesJsonPaths - the path to a Sonar issues JSON file retrieved from their web API -- may be null
      contrastFindingsJsonPath - the path to a Contrast findings JSON file retrieved from their web API -- may be null
      Returns:
      a set of modules that perform dependency injection
    • wantsSarifToolNames

      default List<String> wantsSarifToolNames()
      Tools this provider is interested in processing the SARIF output of. Codemodder CLI will look for the SARIF outputted by tools in this list in the repository root and then provide the results to getModules(Path, List, List, List, List, List, List, Path, Path) as a List of RuleSarifs.

      By default, this returns an empty list.

      Returns:
      a list of tool names that output SARIF that this provider wants to process