Class ProjectLevelSymbolTable

java.lang.Object
org.sonar.python.semantic.ProjectLevelSymbolTable

public class ProjectLevelSymbolTable extends Object
  • Method Details

    • empty

      public static ProjectLevelSymbolTable empty()
    • from

      public static ProjectLevelSymbolTable from(Map<String,Set<Descriptor>> globalDescriptorsByModuleName)
    • removeModule

      public void removeModule(String packageName, String fileName)
    • addModule

      public void addModule(FileInput fileInput, String packageName, PythonFile pythonFile)
    • getSymbol

      @CheckForNull public Symbol getSymbol(@Nullable String fullyQualifiedName)
    • getSymbol

      public Symbol getSymbol(@Nullable String fullyQualifiedName, @Nullable String localSymbolName)
    • getSymbol

      public Symbol getSymbol(@Nullable String fullyQualifiedName, @Nullable String localSymbolName, Map<Descriptor,Symbol> createdSymbolsByDescriptor, Map<String,Symbol> createdSymbolsByFqn)
    • getSymbolsFromModule

      @CheckForNull public Set<Symbol> getSymbolsFromModule(@Nullable String moduleName)
    • getDescriptorsFromModule

      @CheckForNull public Set<Descriptor> getDescriptorsFromModule(@Nullable String moduleName)
    • importsByModule

      public Map<String,Set<String>> importsByModule()
    • insertEntry

      public void insertEntry(String moduleName, Set<Descriptor> descriptors)
    • descriptorsForModule

      @CheckForNull public Set<Descriptor> descriptorsForModule(String moduleName)
    • isDjangoView

      public boolean isDjangoView(@Nullable String fqn)
    • addProjectPackage

      public void addProjectPackage(String projectPackage)
    • projectBasePackages

      public Set<String> projectBasePackages()
    • hasModuleWithPrefix

      public boolean hasModuleWithPrefix(String prefix)
      Checks if any registered module name starts with the given prefix followed by a dot. This is used to detect namespace packages (PEP 420) - packages without __init__.py that contain subpackages.
      Parameters:
      prefix - The module prefix to check (e.g., "acme")
      Returns:
      true if any module starts with "prefix." (e.g., "acme.math" exists)
    • typeShedDescriptorsProvider

      public TypeShedDescriptorsProvider typeShedDescriptorsProvider()
    • stubFilesSymbols

      public Collection<Symbol> stubFilesSymbols()
      Returns stub symbols to be used by SonarSecurity. Ambiguous symbols that only contain class symbols are disambiguated with latest Python version.