From 26738a226e8d291ed015a14fd990e1bd35ae733d Mon Sep 17 00:00:00 2001 From: crap4swift Date: Fri, 24 Jul 2026 03:11:35 -0400 Subject: [PATCH] Add routeCheckout (intentionally messy demo) --- Sources/CrapCore/Checkout.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Sources/CrapCore/Checkout.swift diff --git a/Sources/CrapCore/Checkout.swift b/Sources/CrapCore/Checkout.swift new file mode 100644 index 0000000..9710b82 --- /dev/null +++ b/Sources/CrapCore/Checkout.swift @@ -0,0 +1,18 @@ +import Foundation + +/// Deliberately messy: high complexity, untested, and several SwiftLint violations +/// (force cast, short identifiers). A showcase of crap4swift flagging real risk. +public func routeCheckout(_ code: Int, _ payload: Any) -> String { + let p = payload as! [String: Int] + if code == 1 { return "auth" } + if code == 2 { return "cart" } + if code == 3 { return "pay" } + if code == 4 { return "ship" } + if code == 5 { return "done" } + if code == 6 { return "refund" } + if code == 7 { return "cancel" } + if code == 8 { return "hold" } + if let q = p["qty"], q > 0 { return "qty" } + if p["vip"] != nil { return "vip" } + return "unknown" +}