The 22-case TokenType mapping was split across three initializers to stay under the complexity lint, leaving a preconditionFailure default the types could not prove unreachable, which also tripped the forbidden-patterns gate on every push. One exhaustive switch makes a new TokenType case a compile error instead of a runtime trap; the lint now ignores case statements when counting complexity, since exhaustive closed-enum switches are the point, not a smell.
24 lines
731 B
YAML
24 lines
731 B
YAML
# Mechanical enforcement of the code rules a machine can decide
|
|
# (engineering.md principle: no force-unwrap in shipping code).
|
|
#
|
|
# Inert until Swift sources exist. The CI workflow that runs swiftlint plus
|
|
# build plus test ships with the engine package.
|
|
opt_in_rules:
|
|
- force_unwrapping
|
|
excluded:
|
|
- .build
|
|
- DerivedData
|
|
force_unwrapping: error
|
|
force_try: error
|
|
force_cast: error
|
|
line_length:
|
|
warning: 180
|
|
error: 180
|
|
# Exhaustive switches over closed enums are the intended way to make
|
|
# impossible states unrepresentable; counting their cases as complexity
|
|
# pushes code toward split mappings with trapping defaults instead.
|
|
cyclomatic_complexity:
|
|
ignores_case_statements: true
|
|
trailing_comma:
|
|
mandatory_comma: true
|