From 994bf41a2624a5921555ab641b084dc95d6f654f Mon Sep 17 00:00:00 2001 From: Gilles Grousset Date: Fri, 17 May 2024 16:03:56 +0200 Subject: [PATCH] refact(Rules): rules re-numbering to match unified repository IDs (https://github.com/green-code-initiative/ecoCode/pull/302) --- .../ios/swift/checks/geolocalisation/ThriftyGeolocation.java | 2 +- .../io/ecocode/ios/swift/checks/idleness/RigidAlarmCheck.java | 2 +- .../swift/checks/motionsensor/MotionSensorUpdateRateCheck.java | 2 +- .../io/ecocode/ios/swift/checks/power/ChargeAwarenessCheck.java | 2 +- .../ecocode/ios/swift/checks/power/SaveModeAwarenessCheck.java | 2 +- .../ios/swift/checks/sobriety/BrightnessOverrideCheck.java | 2 +- .../ios/swift/checks/sobriety/LocationUpdatesDisabledCheck.java | 2 +- .../io/ecocode/ios/swift/checks/sobriety/TorchFreeCheck.java | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/geolocalisation/ThriftyGeolocation.java b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/geolocalisation/ThriftyGeolocation.java index fa7f5d4..1fb403b 100644 --- a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/geolocalisation/ThriftyGeolocation.java +++ b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/geolocalisation/ThriftyGeolocation.java @@ -25,7 +25,7 @@ import static io.ecocode.ios.swift.checks.CheckHelper.isImportExisting; -@Rule(key = "EC522") +@Rule(key = "EC524") public class ThriftyGeolocation extends SwiftRuleCheck { private static final String DEFAULT_ISSUE_MESSAGE = "Adapt location accuracy and type to applications needs."; private Swift5Parser.Import_declarationContext importTree = null; diff --git a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/idleness/RigidAlarmCheck.java b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/idleness/RigidAlarmCheck.java index 3d0df2d..43f14cd 100644 --- a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/idleness/RigidAlarmCheck.java +++ b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/idleness/RigidAlarmCheck.java @@ -25,7 +25,7 @@ /** * Check the presence of the class "Timer". */ -@Rule(key = "EC506") +@Rule(key = "EC509") public class RigidAlarmCheck extends SwiftRuleCheck { private static final String DEFAULT_ISSUE_MESSAGE = "Setting a tolerance for timers will allow them to fire later than the scheduled fire date."; diff --git a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/motionsensor/MotionSensorUpdateRateCheck.java b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/motionsensor/MotionSensorUpdateRateCheck.java index d60b68b..98ea747 100644 --- a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/motionsensor/MotionSensorUpdateRateCheck.java +++ b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/motionsensor/MotionSensorUpdateRateCheck.java @@ -28,7 +28,7 @@ import static io.ecocode.ios.swift.checks.CheckHelper.isImportExisting; -@Rule(key="EC547") +@Rule(key="EC534") public class MotionSensorUpdateRateCheck extends SwiftRuleCheck { private static final String DEFAULT_ISSUE_MESSAGE = "Set appropriate motion sensor update rates for the application's needs"; private Swift5Parser.Import_declarationContext importTree = null; diff --git a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/power/ChargeAwarenessCheck.java b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/power/ChargeAwarenessCheck.java index a441c01..806d7d9 100644 --- a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/power/ChargeAwarenessCheck.java +++ b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/power/ChargeAwarenessCheck.java @@ -29,7 +29,7 @@ * or `UIDevice.batteryLevelDidChangeNotification` or `UIDevice.batteryStateDidChangeNotification`. * If found, reports a (positive) issue. */ -@Rule(key = "EC602") +@Rule(key = "EC519") public class ChargeAwarenessCheck extends SwiftRuleCheck { private static final String DEFAULT_ISSUE_MESSAGE = "Monitoring power changes and customizing behavior depending on battery level is a good practice"; private static final String PROPERTY_BATTERY_LEVEL = "UIDevice.current.batteryLevel"; diff --git a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/power/SaveModeAwarenessCheck.java b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/power/SaveModeAwarenessCheck.java index ee0716b..da6f6bd 100644 --- a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/power/SaveModeAwarenessCheck.java +++ b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/power/SaveModeAwarenessCheck.java @@ -24,7 +24,7 @@ import java.util.List; -@Rule(key = "EC543") +@Rule(key = "EC520") public class SaveModeAwarenessCheck extends SwiftRuleCheck { private static final String DEFAULT_ISSUE_MESSAGE = "Taking into account when the device is entering or exiting the power save mode is a good practice"; private static final String PROCESS_INFO = "ProcessInfo.processInfo.isLowPowerModeEnabled"; diff --git a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/BrightnessOverrideCheck.java b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/BrightnessOverrideCheck.java index 60cfbdc..7eef415 100644 --- a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/BrightnessOverrideCheck.java +++ b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/BrightnessOverrideCheck.java @@ -25,7 +25,7 @@ /** * Check the use of "UIScreen.main.brightness" and triggers when set. */ -@Rule(key = "EC523") +@Rule(key = "EC522") public class BrightnessOverrideCheck extends SwiftRuleCheck { private static final String DEFAULT_ISSUE_MESSAGE = "Do not force Brightness in your code, unless absolutely necessary"; @Override diff --git a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/LocationUpdatesDisabledCheck.java b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/LocationUpdatesDisabledCheck.java index a02ae3c..31419e4 100644 --- a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/LocationUpdatesDisabledCheck.java +++ b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/LocationUpdatesDisabledCheck.java @@ -26,7 +26,7 @@ /** * Check the use of "CLLocationManager#pausesLocationUpdatesAutomatically" and triggers when set to false. */ -@Rule(key = "EC521") +@Rule(key = "EC533") public class LocationUpdatesDisabledCheck extends SwiftRuleCheck { private static final String DEFAULT_ISSUE_MESSAGE = "Do not disable location updates pause, unless absolutely necessary"; @Override diff --git a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/TorchFreeCheck.java b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/TorchFreeCheck.java index 357d666..954edec 100644 --- a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/TorchFreeCheck.java +++ b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/TorchFreeCheck.java @@ -25,7 +25,7 @@ /** * Check the use of "AVCaptureTorchMode.on", "setTorchModeOn(level: Float)", or "torchMode = .on" and triggers when set to true. */ -@Rule(key = "EC503") +@Rule(key = "EC530") public class TorchFreeCheck extends SwiftRuleCheck { private static final String DEFAULT_ISSUE_MESSAGE = "Usage of `AVCaptureDevice#torchMode` or `AVCaptureDevice#setTorchModeOn(level:)` must absolutely be avoided"; @Override