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 is the single source of truth for package root resolution. It handles:

  • Method Details

    • resolve

      public static PackageResolutionResult resolve(org.sonar.api.batch.fs.FileSystem fileSystem, org.sonar.api.config.Configuration config)
      Resolves package root directories for the project.

      Attempts to extract source roots from pyproject.toml and setup.py build system configurations. When no build config files exist, returns empty roots so that FQN resolution falls back to legacy __init__.py-based detection. When build config files exist but provide no source roots, conventional folders take priority over sonar.sources, then base directory as last resort.

      Parameters:
      fileSystem - the Sonar file system providing the base directory
      config - the Sonar configuration
      Returns:
      resolution result including resolved root absolute paths and method information