Add PureXML.parse(bytes:) and events(bytes:) for raw [UInt8] input. The encoding is detected following the XML sniff order (BOM first, then the <? byte pattern, defaulting to UTF-8) and decoded with the Swift standard library only, so the package stays Foundation-free and portable. UTF-8 and UTF-16 (both byte orders, with or without a BOM) are supported, the encoding set the XML spec requires. Malformed input (odd-length UTF-16) raises ParseError.malformedEncoding. PureXML.Parsing.InputEncoding.detect(_:) exposes the detector. The lint rule optional_data_string_conversion is disabled because its suggested fix is a Foundation API this package cannot use. Reimplemented from the documented XML byte-detection algorithm; no upstream code copied.
23 lines
679 B
YAML
23 lines
679 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
|
|
disabled_rules:
|
|
# Suggests Foundation's String(bytes:encoding:); PureXML is Foundation-free, so
|
|
# String(decoding:as:) from the standard library is the correct conversion.
|
|
- optional_data_string_conversion
|
|
excluded:
|
|
- .build
|
|
- DerivedData
|
|
force_unwrapping: error
|
|
force_try: error
|
|
force_cast: error
|
|
line_length:
|
|
warning: 180
|
|
error: 180
|
|
trailing_comma:
|
|
mandatory_comma: true
|