From 7001577e6798530c943ac4cf03258bc172927a67 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Fri, 24 Jul 2026 22:58:44 -0500 Subject: chore: clear actionable SonarCloud smells (shell [[, merged if) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Scripts/audit-a11y.sh: replace `[ ... ]` with `[[ ... ]]` in the seven shell conditionals SonarCloud flagged (shelldre:S7688). The script is bash (`#!/usr/bin/env bash`), so `[[` is safe and avoids word-splitting/globbing footguns. The jq `[ .devices | ... ]` filter is untouched — it is not a shell test. - AccessibilityAuditHarness.swift: fold the nested `if` in the noise classifier into a single conditional (swift:S1066); behavior unchanged. The remaining open SonarCloud issues (S1075 https literals, S115 external-JSON CodingKeys, S107 parameter counts, S3087 callback nesting) are false positives or intentional and are being resolved as Won't Fix / Safe in SonarCloud, consistent with the v4.8.3 static-analysis policy in RELEASE_ROADMAP.md. --- DomainDigUITests/AccessibilityAuditHarness.swift | 8 ++++---- Scripts/audit-a11y.sh | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/DomainDigUITests/AccessibilityAuditHarness.swift b/DomainDigUITests/AccessibilityAuditHarness.swift index 24f900e..58583e1 100644 --- a/DomainDigUITests/AccessibilityAuditHarness.swift +++ b/DomainDigUITests/AccessibilityAuditHarness.swift @@ -184,10 +184,10 @@ enum AccessibilityAuditHarness { // and the search field's hit region at accessibility sizes is the // system's own control. Reading `elementType` here is safe; reading // `frame` is not (it kills element attribution for the whole audit). - if let type = issue.element?.elementType, type == .searchField || type == .textField { - if issue.auditType.contains(.textClipped) || issue.auditType.contains(.hitRegion) { - return "system field placeholder/hit region, length-independent" - } + if let type = issue.element?.elementType, + type == .searchField || type == .textField, + issue.auditType.contains(.textClipped) || issue.auditType.contains(.hitRegion) { + return "system field placeholder/hit region, length-independent" } // Unattributed clipped-text/dynamic-type findings. Bisection showed the diff --git a/Scripts/audit-a11y.sh b/Scripts/audit-a11y.sh index 9ac3aa0..9119fd7 100755 --- a/Scripts/audit-a11y.sh +++ b/Scripts/audit-a11y.sh @@ -43,14 +43,14 @@ DEPLOYMENT_TARGET=$( | awk -F' = ' '/ IPHONEOS_DEPLOYMENT_TARGET = /{print $2; exit}' ) -if [ -z "${DEPLOYMENT_TARGET:-}" ]; then +if [[ -z "${DEPLOYMENT_TARGET:-}" ]]; then echo "error: could not read IPHONEOS_DEPLOYMENT_TARGET" >&2 exit 1 fi DT_MAJOR="${DEPLOYMENT_TARGET%%.*}" DT_MINOR="${DEPLOYMENT_TARGET##*.}" -[ "$DT_MINOR" = "$DEPLOYMENT_TARGET" ] && DT_MINOR=0 +[[ "$DT_MINOR" = "$DEPLOYMENT_TARGET" ]] && DT_MINOR=0 FLOOR_RANK=$(( DT_MAJOR * 1000 + DT_MINOR )) echo " deployment target: $DEPLOYMENT_TARGET (rank $FLOOR_RANK)" @@ -82,7 +82,7 @@ run_tier() { local sim udid label sim=$(select_sim "$which") - if [ -z "$sim" ]; then + if [[ -z "$sim" ]]; then echo "error: no iPhone simulator at or above iOS $DEPLOYMENT_TARGET installed" >&2 echo "hint: install one with 'xcodebuild -downloadPlatform iOS'" >&2 return 1 @@ -94,7 +94,7 @@ run_tier() { echo echo "==> $which: $label" - if [ "$which" = "floor" ] && [ "$(echo "$sim" | jq -r .rank)" -ge $(( (DT_MAJOR + 1) * 1000 )) ]; then + if [[ "$which" = "floor" ]] && [[ "$(echo "$sim" | jq -r .rank)" -ge $(( (DT_MAJOR + 1) * 1000 )) ]]; then echo " NOTE: nearest installed runtime is a major version above the $DEPLOYMENT_TARGET" echo " deployment target, so this is not true floor coverage." fi @@ -113,7 +113,7 @@ run_tier() { } status=0 -if [ "$TIER" = "both" ]; then +if [[ "$TIER" = "both" ]]; then run_tier floor || status=1 run_tier current || status=1 else @@ -121,7 +121,7 @@ else fi echo -if [ "$status" -eq 0 ]; then +if [[ "$status" -eq 0 ]]; then echo "==> Done. Findings above are the burndown list for issue #21." echo " They are reported, not enforced — widen" echo " AccessibilityAuditHarness.enforcedAuditTypes as each phase lands." -- cgit v1.2.3