Package org.sonar.plugins.java.api
Interface ModuleScannerContext
- All Known Subinterfaces:
InputFileScannerContext
,JavaFileScannerContext
- All Known Implementing Classes:
DefaultInputFileScannerContext
,DefaultJavaFileScannerContext
,DefaultModuleScannerContext
,JavaFileScannerContextForTests
public interface ModuleScannerContext
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addIssueOnProject
(JavaCheck check, String message) Report an issue at the project level.Java version defined for the analysis usingsonar.java.version
parameter.org.sonar.api.batch.fs.InputComponent
InputComponent
representing the project being analyzedDeprecated.boolean
To be used to know if the current file is in an android context or not.
-
Method Details
-
addIssueOnProject
Report an issue at the project level.- Parameters:
check
- The check raising the issue.message
- Message to display to the user- Since:
- SonarJava 5.12: Dropping support of file-related methods
-
getProject
org.sonar.api.batch.fs.InputComponent getProject()InputComponent
representing the project being analyzed- Returns:
- the project component
- Since:
- SonarJava 5.12: Dropping support of file-related methods
-
getWorkingDirectory
Deprecated.usegetRootProjectWorkingDirectory()
insteadThe working directory used by the analysis.- Returns:
- the current working directory.
-
getJavaVersion
JavaVersion getJavaVersion()Java version defined for the analysis usingsonar.java.version
parameter.- Returns:
- JavaVersion object with API to act on it.
-
inAndroidContext
boolean inAndroidContext()To be used to know if the current file is in an android context or not. This value is determined thanks to the presence of android classes in the classpath.- Returns:
- true if the current file is in an android context.
-
getCacheContext
CacheContext getCacheContext()- Returns:
- the
CacheContext
applicable to this scan.
-
getRootProjectWorkingDirectory
File getRootProjectWorkingDirectory()- Returns:
- The working directory used by the analysis on project-level. Even if the project contains multiple modules, this method will always return the same value.
-
getModuleKey
String getModuleKey()- Returns:
- A key that uniquely identifies the current module, provided that this project consists of multiple modules.
-
getRootProjectWorkingDirectory()
instead