diff --git a/ModularSwiftUI/ModularSwiftUI/Sources/Features/CharacterList/Presentation/CharacterListViewModel.swift b/ModularSwiftUI/ModularSwiftUI/Sources/Features/CharacterList/Presentation/CharacterListViewModel.swift index 6e2f88b..74f941e 100644 --- a/ModularSwiftUI/ModularSwiftUI/Sources/Features/CharacterList/Presentation/CharacterListViewModel.swift +++ b/ModularSwiftUI/ModularSwiftUI/Sources/Features/CharacterList/Presentation/CharacterListViewModel.swift @@ -46,6 +46,45 @@ public final class CharacterListViewModel { await interactor.setSelectedCharacter(with: id) coordinator.didTapCharacter() } + + // Function that will fail SonarQube analysis + func problematicFunction() { + var unusedVariable = "This variable is never used" + let anotherUnused = 42 + + // Dead code + if false { + print("This will never execute") + } + + // Magic numbers + let timeout = 30 + let maxRetries = 3 + + // Duplicate code + for i in 0..<10 { + print("Processing item \(i)") + } + + for j in 0..<10 { + print("Processing item \(j)") + } + + // Complex nested conditions + if timeout > 0 { + if maxRetries > 0 { + if unusedVariable.count > 0 { + if anotherUnused > 0 { + print("Too many nested conditions") + } + } + } + } + + // Unused parameter (if this was a function with parameters) + let _ = unusedVariable + let _ = anotherUnused + } } private extension CharacterListViewModel {