From 30b3456935e069ae51179ea33ea6b57f42bf1d46 Mon Sep 17 00:00:00 2001 From: Zipeng WU Date: Thu, 24 Feb 2022 17:40:25 +0100 Subject: SONAR-16064 new API in SensorContext to indicate possibility to skip unchanged files --- .../src/main/java/org/sonar/api/batch/fs/InputFile.java | 6 ------ .../main/java/org/sonar/api/batch/sensor/SensorContext.java | 13 +++++++++++-- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'sonar-plugin-api/src/main/java') 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,12 +57,21 @@ public interface SensorContext { */ @Deprecated Settings settings(); + /** * Get settings of the project. * @since 6.5 */ 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. */ @@ -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(); -- cgit v1.2.3