diff options
author | Zipeng WU <zipeng.wu@sonarsource.com> | 2022-02-24 17:40:25 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-02-26 20:02:50 +0000 |
commit | 30b3456935e069ae51179ea33ea6b57f42bf1d46 (patch) | |
tree | 96ab00efcb033f8c31261a761cac356981d4b641 /sonar-plugin-api/src/main/java | |
parent | 765ac490d9bb24d575f331b4fbb2b5d2f6654319 (diff) | |
download | sonarqube-30b3456935e069ae51179ea33ea6b57f42bf1d46.tar.gz sonarqube-30b3456935e069ae51179ea33ea6b57f42bf1d46.zip |
SONAR-16064 new API in SensorContext to indicate possibility to skip unchanged files
Diffstat (limited to 'sonar-plugin-api/src/main/java')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFile.java | 6 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java | 13 |
2 files changed, 11 insertions, 8 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFile.java index 943731c438c..1dec70d9422 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFile.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFile.java @@ -48,9 +48,7 @@ public interface InputFile extends IndexedFile { /** * Status regarding previous analysis - * @deprecated since 7.7 preview mode was dropped */ - @Deprecated enum Status { SAME, CHANGED, ADDED } @@ -134,10 +132,6 @@ public interface InputFile extends IndexedFile { */ String contents() throws IOException; - /** - * @deprecated since 7.7 preview/issue mode was removed - */ - @Deprecated Status status(); /** diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java index f1d4b06c413..d1a43ae930d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java @@ -57,6 +57,7 @@ public interface SensorContext { */ @Deprecated Settings settings(); + /** * Get settings of the project. * @since 6.5 @@ -64,6 +65,14 @@ public interface SensorContext { Configuration config(); /** + * In some situations, there is no need to analyze unchanged files, as reported by {@link InputFile#status()} as {@link InputFile.Status#SAME}, + * and analyzers can skip reporting any data for those files. + * Plugins should be prepared for the flag to be always false in the future. + * @since 9.4 + */ + boolean canSkipUnchangedFiles(); + + /** * Get filesystem of the project. */ FileSystem fileSystem(); @@ -182,9 +191,9 @@ public interface SensorContext { /** * Builder to declare which parts of the code is significant code. * Ranges that are not reported as significant code will be ignored and won't be considered when calculating which lines were modified. - * + * * If the significant code is not reported for a file, it is assumed that the entire file is significant code. - * + * * @since 7.2 */ NewSignificantCode newSignificantCode(); |