Package org.sonar.plugins.python.indexer
Class PythonIndexer
java.lang.Object
org.sonar.plugins.python.indexer.PythonIndexer
- Direct Known Subclasses:
SonarLintPythonIndexer,SonarQubePythonIndexer
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPythonIndexer(ProjectConfigurationBuilder projectConfigurationBuilder) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidanalyzeNamespacePackages(ProjectTree projectTree) abstract voidbuildOnce(org.sonar.api.batch.sensor.SensorContext context) abstract CacheContextbooleancanBeFullyScannedWithoutParsing(PythonInputFile inputFile) booleanvoidcollectPackageNames(List<PythonInputFile> inputFiles) org.sonar.api.batch.fs.InputFilegetFileWithId(String fileId) packageName(PythonInputFile inputFile) abstract voidpostAnalysis(org.sonar.api.batch.sensor.SensorContext context) protected voidresolvePackageRoots(org.sonar.api.batch.sensor.SensorContext context) Resolves package root directories for the project.protected PackageResolutionResultresolvePackageRootsWithMethod(org.sonar.api.batch.sensor.SensorContext context) Resolves package root directories and tracks the resolution method used.voidsetSonarLintCache(SonarLintCache sonarLintCache)
-
Field Details
-
projectBaseDirAbsolutePath
-
packageRoots
-
packageResolutionResult
-
-
Constructor Details
-
PythonIndexer
-
-
Method Details
-
projectLevelSymbolTable
-
projectConfig
-
projectLevelTypeTable
-
recreateProjectLevelTypeTable
protected void recreateProjectLevelTypeTable() -
packageName
-
packageRoots
-
resolvePackageRoots
Resolves package root directories for the project.Attempts to extract source roots from pyproject.toml and setup.py build system configurations. Falls back to sonar.sources property, conventional folders (src/, lib/), or the project base directory.
- Parameters:
context- the sensor context containing filesystem and configuration- Returns:
- list of resolved package root absolute paths
-
resolvePackageRootsWithMethod
protected PackageResolutionResult resolvePackageRootsWithMethod(org.sonar.api.batch.sensor.SensorContext context) Resolves package root directories and tracks the resolution method used.- Parameters:
context- the sensor context containing filesystem and configuration- Returns:
- resolution result including roots and method information
-
collectPackageNames
-
analyzeNamespacePackages
-
namespacePackageTelemetry
-
buildOnce
public abstract void buildOnce(org.sonar.api.batch.sensor.SensorContext context) -
postAnalysis
public abstract void postAnalysis(org.sonar.api.batch.sensor.SensorContext context) -
setSonarLintCache
-
getFileWithId
-
canBePartiallyScannedWithoutParsing
- Parameters:
inputFile-- Returns:
- true if a file is partially skippable, false otherwise We consider a file to be partially skippable if it is unchanged, but may depend on impacted files. Regular Python rules will not run on such files. Security UCFGs and DBD IRs will be regenerated for them if they do depend on impacted files. In such case, these files will still need to be parsed when Security or DBD rules are enabled.
-
canBeFullyScannedWithoutParsing
- Parameters:
inputFile-- Returns:
- true if a file is fully skippable, false otherwise We consider a file to be fully skippable if it is unchanged and does NOT depend on any impacted file. Regular Python rules will not run on these files. Security UCFGs and DBD IRs will be retrieved from the cache. These files will not be parsed.
-
cacheContext
-