diff --git a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/AnimationFreeCheck.java b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/AnimationFreeCheck.java
index c6c8ac5..4d94a0a 100644
--- a/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/AnimationFreeCheck.java
+++ b/swift-lang/src/main/java/io/ecocode/ios/swift/checks/sobriety/AnimationFreeCheck.java
@@ -29,7 +29,7 @@
/**
* Check the use of "UIScreen.main.brightness" and triggers when set.
*/
-@Rule(key = "ESOB007")
+@Rule(key = "EC603")
public class AnimationFreeCheck extends SwiftRuleCheck {
private static final String DEFAULT_ISSUE_MESSAGE = "Usage of Animations must absolutely be avoided";
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 dac83b5..357d666 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 = "EC23")
+@Rule(key = "EC503")
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
diff --git a/swift-lang/src/main/resources/io/ecocode/rules/swift/ESOB007.html b/swift-lang/src/main/resources/io/ecocode/rules/swift/ESOB007.html
deleted file mode 100644
index a3126d9..0000000
--- a/swift-lang/src/main/resources/io/ecocode/rules/swift/ESOB007.html
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
Animations play a crucial role in creating a dynamic and engaging user interface in iOS applications. Both UIKit and SwiftUI provide powerful tools to create smooth and appealing animations. Developers need to be familiar with various methods and properties to implement animations effectively.
-Animation Methods in UIKit and SwiftUI
-Noncompliant Code Example UIKit
-
- UIView.animate(withDuration:animations:)
- UIView.animate(withDuration:animations:completion:)
- UIView.animate(withDuration:delay:options:animations:completion:)
- UIView.animateKeyframes(withDuration:delay:options:animations:completion:)
- UIView.transition(with:duration:options:animations:completion:)
- CABasicAnimation
- CAKeyframeAnimation
- CATransition
-
-Noncompliant Code Example SwiftUI
-
- withAnimation
- Animation
- AnyTransition
- .animation(Animation?)
- .transition(AnyTransition)
- .onAppear(perform:)
- .onDisappear(perform:)
-
-To ensure animations are used effectively without draining the device's battery, it's important to check for unnecessary animations and optimize them. This can be done by reviewing the use of functions like withAnimation(::)
, the animation(_:value:)
view modifier, and the binding’s animation(_:) method
in SwiftUI, as well as checking the use of UIKit's animation methods.
-This revised HTML content now focuses on the animation functionalities provided by UIKit and SwiftUI, which are essential for iOS app development. The original content related to screen brightness has
\ No newline at end of file
diff --git a/swift-lang/src/main/resources/io/ecocode/rules/swift/ESOB007.json b/swift-lang/src/main/resources/io/ecocode/rules/swift/ESOB007.json
deleted file mode 100644
index 63c1ec7..0000000
--- a/swift-lang/src/main/resources/io/ecocode/rules/swift/ESOB007.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "key": "ESOB007",
- "title": "Animation Methods in UIKit and SwiftUI",
- "defaultSeverity": "Major",
- "description": "Animations play a crucial role in creating a dynamic and engaging user interface in iOS applications. Both UIKit and SwiftUI provide powerful tools to create smooth and appealing animations. Developers need to be familiar with various methods and properties to implement animations effectively.\n\nAnimation Methods in UIKit and SwiftUI\n\nNoncompliant Code Example UIKit\n\n- UIView.animate(withDuration:animations:)\n- UIView.animate(withDuration:animations:completion:)\n- UIView.animate(withDuration:delay:options:animations:completion:)\n- UIView.animateKeyframes(withDuration:delay:options:animations:completion:)\n- UIView.transition(with:duration:options:animations:completion:)\n- CABasicAnimation\n- CAKeyframeAnimation\n- CATransition\n\nNoncompliant Code Example SwiftUI\n\n- withAnimation\n- Animation\n- AnyTransition\n- .animation(Animation?)\n- .transition(AnyTransition)\n- .onAppear(perform:)\n- .onDisappear(perform:)\n\nTo ensure animations are used effectively without draining the device's battery, it's important to check for unnecessary animations and optimize them. This can be done by reviewing the use of functions like withAnimation(::), the animation(_:value:) view modifier, and the binding’s animation(_:) method in SwiftUI, as well as checking the use of UIKit's animation methods.",
- "status": "ready",
- "remediation": {
- "func": "Constant/Issue",
- "constantCost": "5min"
- },
- "tags": [
- "sobriety",
- "environment",
- "ecocode",
- "eco-design"
- ],
- "type": "CODE_SMELL"
- }
-
\ No newline at end of file
diff --git a/swift-lang/src/test/java/io/ecocode/ios/swift/EcoCodeSwiftRulesDefinitionTest.java b/swift-lang/src/test/java/io/ecocode/ios/swift/EcoCodeSwiftRulesDefinitionTest.java
index 474ef27..310d77b 100644
--- a/swift-lang/src/test/java/io/ecocode/ios/swift/EcoCodeSwiftRulesDefinitionTest.java
+++ b/swift-lang/src/test/java/io/ecocode/ios/swift/EcoCodeSwiftRulesDefinitionTest.java
@@ -60,7 +60,7 @@ public void testRegisteredRules() {
@Test
public void assertRuleProperties() {
- Rule rule = repository.rule("ESOB007");
+ Rule rule = repository.rule("EC603");
assertThat(rule).isNotNull();
assertThat(rule.name()).isEqualTo("Animation Methods in UIKit and SwiftUI");
assertThat(rule.debtRemediationFunction().type()).isEqualTo(Type.CONSTANT_ISSUE);
diff --git a/swift-lang/src/test/java/io/ecocode/ios/swift/checks/sobriety/AnimationFreeCheckTest.java b/swift-lang/src/test/java/io/ecocode/ios/swift/checks/sobriety/AnimationFreeCheckTest.java
index d2e05d4..bcc089e 100644
--- a/swift-lang/src/test/java/io/ecocode/ios/swift/checks/sobriety/AnimationFreeCheckTest.java
+++ b/swift-lang/src/test/java/io/ecocode/ios/swift/checks/sobriety/AnimationFreeCheckTest.java
@@ -83,7 +83,7 @@ private void assertAnimationFreeIssue(String file, int line) {
}
private void assertIssue(Issue issue, int line) {
- assertThat(issue.ruleKey().rule()).isEqualTo("ESOB007");
+ assertThat(issue.ruleKey().rule()).isEqualTo("EC603");
assertThat(issue.ruleKey().repository()).isEqualTo("ecoCode-swift");
IssueLocation location = issue.primaryLocation();
assertThat(location.textRange().start().line()).isEqualTo(line);
diff --git a/swift-lang/src/test/java/io/ecocode/ios/swift/checks/sobriety/TorchFreeCheckTest.java b/swift-lang/src/test/java/io/ecocode/ios/swift/checks/sobriety/TorchFreeCheckTest.java
index 8f74cf5..15caa7f 100644
--- a/swift-lang/src/test/java/io/ecocode/ios/swift/checks/sobriety/TorchFreeCheckTest.java
+++ b/swift-lang/src/test/java/io/ecocode/ios/swift/checks/sobriety/TorchFreeCheckTest.java
@@ -57,7 +57,7 @@ private void assertTorchIssue(String file, int line) {
}
private void assertIssue(Issue issue, int line) {
- assertThat(issue.ruleKey().rule()).isEqualTo("EC23");
+ assertThat(issue.ruleKey().rule()).isEqualTo("EC503");
assertThat(issue.ruleKey().repository()).isEqualTo("ecoCode-swift");
IssueLocation location = issue.primaryLocation();
assertThat(location.textRange().start().line()).isEqualTo(line);