From c6f305357c3648a3add8f399db988cc7aaa56424 Mon Sep 17 00:00:00 2001 From: Mihaela Mihaljevic Date: Thu, 18 Jun 2026 20:30:46 +0200 Subject: [PATCH] chore(rules): align lint config and pointer with canonical rules-swift Make public/rules-swift the canonical source (per project direction) and adopt its opt-in lint rules that PureXML lacked: empty_count, explicit_init, first_where, sorted_first_last, unused_import, plus its todo disable. All pass with zero violations on the existing sources. PureXML keeps its coherent, stricter tuning where the canon is a self-described 'starting point': force_unwrapping/force_try/force_cast = error (safety), and trailing commas mandated in both swiftformat (--commas always) and swiftlint (mandatory_comma) to resolve the canon's formatter-adds vs linter-flags mismatch. docs/rules/README.md now points at public/rules-swift and documents the tuning. --- .swiftlint.yml | 8 ++++++++ docs/rules/README.md | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 1397026..39828f2 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -5,10 +5,18 @@ # build plus test ships with the engine package. opt_in_rules: - force_unwrapping + # Adopted from the canonical rules-swift opt-in set. + - empty_count + - explicit_init + - first_where + - sorted_first_last + - unused_import 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 + # rules-swift disables todo; PureXML tracks TODOs in issues, not the linter. + - todo excluded: - .build - DerivedData diff --git a/docs/rules/README.md b/docs/rules/README.md index ad22984..2b98343 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -25,6 +25,11 @@ Project-specific overrides: The broader rule files are retained for detailed guidance. When they include generic examples, apply the PureXML-specific overrides above. -Canonical Swift rules live at `/Volumes/Code/DeveloperExt/private/rules-swift` +Canonical Swift rules live at `/Volumes/Code/DeveloperExt/public/rules-swift` (especially `validation-rules.md` and `parsing-rules.md`). Prefer that source -when `docs/rules/` copies drift. +when `docs/rules/` copies drift. PureXML's committed `.swiftlint.yml` and +`.swiftformat` are the coherent project tuning of that canon: they adopt its +opt-in rule set and shared formatter directives, keep stricter safety +(`force_unwrapping`/`force_try`/`force_cast` = error), and resolve the canon's +`--commas always` vs default-`trailing_comma` mismatch by mandating trailing +commas in both tools.