From 95e9bcabae3c1b0fd855e45dcb77503c5f99d830 Mon Sep 17 00:00:00 2001 From: Mihaela Mihaljevic Date: Thu, 2 Jul 2026 21:38:06 +0200 Subject: [PATCH] chore(rules): track shared-rules baseline v1.1.0 --- .forgejo/workflows/rules-conformance.yml | 24 ++++++++++++++++++ .rules-version | 1 + .swiftformat | 12 +++++++++ .swiftlint.yml | 31 ++++++++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 .forgejo/workflows/rules-conformance.yml create mode 100644 .rules-version create mode 100644 .swiftformat create mode 100644 .swiftlint.yml diff --git a/.forgejo/workflows/rules-conformance.yml b/.forgejo/workflows/rules-conformance.yml new file mode 100644 index 0000000..a035237 --- /dev/null +++ b/.forgejo/workflows/rules-conformance.yml @@ -0,0 +1,24 @@ +# Managed by rules-swift (scripts/sync-rules.sh). Verifies this repo tracks the +# CURRENT shared-rules baseline. The repo's own .swiftformat/.swiftlint.yml are +# repo-specific (baseline + project rules) and are intentionally NOT byte-checked. +name: rules-conformance +on: + push: + pull_request: + workflow_dispatch: +jobs: + rules: + runs-on: macos + steps: + - uses: actions/checkout@v4 + - name: Rules baseline freshness (VERSION) + run: | + BASE=https://codeberg.org/Mihaela/rules-swift/raw/branch/main + canon=$(curl -fsSL "$BASE/VERSION" | tr -d '[:space:]') + mine=$(tr -d '[:space:]' < .rules-version 2>/dev/null || echo MISSING) + if [ "$mine" != "$canon" ]; then + echo "STALE: shared-rules baseline is v$canon, this repo tracks v$mine." + echo "Review the baseline diff, fold it into this repo's rules, then set .rules-version to $canon." + exit 1 + fi + echo "rules baseline FRESH at v$canon (repo-specific rules preserved, not checked)" diff --git a/.rules-version b/.rules-version new file mode 100644 index 0000000..9084fa2 --- /dev/null +++ b/.rules-version @@ -0,0 +1 @@ +1.1.0 diff --git a/.swiftformat b/.swiftformat new file mode 100644 index 0000000..4445813 --- /dev/null +++ b/.swiftformat @@ -0,0 +1,12 @@ +# SwiftFormat configuration. https://github.com/nicklockwood/SwiftFormat +# This is a starting point; adjust to your project, but keep it committed so +# every clone and CI run formats identically. + +--swiftversion 6.0 +--indent 4 +--maxwidth 180 +--commas always +--self remove +--importgrouping testable-bottom +--trailingclosures +--exclude .build,Packages/.build,.git diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..b7499b4 --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,31 @@ +# SwiftLint configuration. https://github.com/realm/SwiftLint +# A starting point; tune to your project, but keep it committed and run it with +# --strict so warnings cannot accumulate. + +disabled_rules: + - todo + +opt_in_rules: + - empty_count + - explicit_init + - first_where + - force_unwrapping + - sorted_first_last + - unused_import + +line_length: + warning: 180 + error: 220 + ignores_comments: true + ignores_urls: true + +identifier_name: + min_length: 2 + +type_name: + min_length: 2 + +excluded: + - .build + - Packages/.build + - .git