Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down