Trailing Semicolon
ID |
swift.trailing_semicolon |
Severity |
info |
Remediation Complexity |
medium |
Remediation Risk |
low |
Remediation Effort |
medium |
Resource |
Code Smell |
Language |
Swift |
Tags |
code-smell, style |
Description
Reports a trailing ; at the end of a Swift statement. Semicolons in
Swift are optional; they are only required to separate two statements
sharing the same physical line. A ; that has nothing after it on the
line is pure noise.
let a = 1; // FLAW
print(a); // FLAW
let c = 3; let d = 4 // OK — `;` separates two statements
let s = "x;y" // OK — `;` inside a string literal