From ee6cdd95e5912a91b1dd1797d9b5eb6a04f47770 Mon Sep 17 00:00:00 2001 From: Agustin Kassis Date: Fri, 23 Oct 2026 17:22:53 -0300 Subject: [PATCH 1/2] ci: enforce dart format, and format gift.dart to satisfy it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tree now satisfies `dart format`, so the check goes into CI alongside analyze and test. Formatting lib/domain/ticket/gift.dart exposed a disagreement between the two tools: the formatter wraps the body of the single-statement `if` in `get detail` onto its own line, which then trips `curly_braces_in_flow_control_structures` (that lint only tolerates a braceless `if` when the whole statement fits on one line). Writing the braces satisfies both. Noted in the workflow so the next person does not have to rediscover it. No behaviour change — the rest of the diff is line-wrapping, and the 110 tests still pass. Co-Authored-By: Claude Opus 5 --- .github/workflows/ci.yml | 10 ++++++---- README.md | 4 ++-- lib/domain/ticket/gift.dart | 12 ++++++++---- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2f2fcc..5a6ef64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,10 +6,6 @@ name: CI # gitignored, and MainActivity.kt imports com.zcs.sdk unconditionally, so a # Kotlin compile cannot succeed on a clean clone. See "The proprietary bits" # in README.md. Android builds stay local, on a machine that has the SDK. -# -# `dart format --set-exit-if-changed` is also absent on purpose: the tree does -# not currently satisfy it (lib/domain/ticket/gift.dart). Reformat first, then -# add the step. on: pull_request: @@ -44,6 +40,12 @@ jobs: - run: flutter pub get + # Note: the formatter and `curly_braces_in_flow_control_structures` + # disagree about a single-statement `if` whose body is wrapped onto its + # own line — the formatter wants the wrap, the lint wants braces. Write + # the braces and both are satisfied. + - run: dart format --output=none --set-exit-if-changed . + - run: flutter analyze - run: flutter test diff --git a/README.md b/README.md index 046b856..5bc4c58 100644 --- a/README.md +++ b/README.md @@ -304,8 +304,8 @@ stale check-in screen for an entrada that has already been claimed. `analyzer ^13`, which cannot co-resolve with the analyzer `flutter_riverpod` drags in through `test`. - `sqlite3_flutter_libs` is EOL; `package:sqlite3` v3 bundles the natives. -- **CI runs the Dart checks only** — `flutter analyze` and `flutter test` on - every PR and every push to `main`, pinned to Flutter 3.44.4 +- **CI runs the Dart checks only** — `dart format`, `flutter analyze` and + `flutter test` on every PR and every push to `main`, pinned to Flutter 3.44.4 ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)). There is no APK job: the ZCS jars the Android build needs are not redistributable, so that build stays on a machine that has them. See diff --git a/lib/domain/ticket/gift.dart b/lib/domain/ticket/gift.dart index 3d3c753..242a428 100644 --- a/lib/domain/ticket/gift.dart +++ b/lib/domain/ticket/gift.dart @@ -50,9 +50,11 @@ class Gift { return Gift( id: explicitId != null && explicitId.isNotEmpty ? explicitId - : (kind == 'sats_treasure' && claimCode != null && claimCode.isNotEmpty - ? claimCode - : key), + : (kind == 'sats_treasure' && + claimCode != null && + claimCode.isNotEmpty + ? claimCode + : key), label: (name == null || name.isEmpty) ? key : name, imageUrl: json['image_url']?.toString(), lnurl: json['lnurl']?.toString(), @@ -127,7 +129,9 @@ class Gift { String get detail { if (!isTreasure) return ''; - if (quantityLabel != null && quantityLabel!.isNotEmpty) return quantityLabel!; + if (quantityLabel != null && quantityLabel!.isNotEmpty) { + return quantityLabel!; + } if (satsAmount != null && satsAmount! > 0) return '$satsAmount sats'; return ''; } From 01f16fcc4ce23095c8173f2cb4ac4379bb6f17cb Mon Sep 17 00:00:00 2001 From: Agustin Kassis Date: Fri, 23 Oct 2026 18:37:34 -0300 Subject: [PATCH 2/2] ci: say "format" in the job name now that the job formats The check appears in the PR list as its display name, so it should name all three steps before anything pins branch protection to it. Co-Authored-By: Claude Opus 5 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a6ef64..3e8c249 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ env: jobs: dart: - name: analyze + test + name: format + analyze + test runs-on: ubuntu-latest steps: - uses: actions/checkout@v5