Class PackageRootResolver

java.lang.Object
org.sonar.plugins.python.indexer.PackageRootResolver

public class PackageRootResolver extends Object
Resolves package root directories for Python projects.

This class validates and resolves package roots extracted from build system configurations (e.g., pyproject.toml) and provides fallback resolution when no roots are configured.

  • Method Details

    • resolve

      public static List<String> resolve(List<String> extractedRoots, org.sonar.api.config.Configuration config, File baseDir)
      Resolves package root directories.

      If extracted roots from build system configuration are provided (already as absolute paths resolved relative to their config file locations), returns them directly. Otherwise, applies a fallback chain to determine appropriate roots.

      Parameters:
      extractedRoots - roots extracted from build system config, already as absolute paths
      config - the Sonar configuration to read sonar.sources property
      baseDir - the project base directory (used only for fallback resolution)
      Returns:
      list of resolved package root absolute paths