Modern Apps git

← Modern-Apps.git

games/logicgate: fix all lint findings

Commit
7bc939c1b7cbbb9e13ed15e357de3b4db42f6c56
Author
Vayun Mathur <[email protected]>
When
2026-11-17 04:41 UTC (19 days ago)
Parents
c91edc9
Fix every lint error, warning and hint reported for the logicgate
module own sources by :games:logicgate:lintDev, now 0 own-file
findings (remaining report entries are transitive library findings).

- NotificationPermission: added POST_NOTIFICATIONS uses-permission
  to AndroidManifest.xml, following games/chess fa14e2ad7.
- PluralsCandidate (values/strings.xml lg_component_summary and
  lg_component_broken): converted both strings to <plurals> with
  the full English CLDR quantities (one/other). The flagged count
  is the output count (%2$d), so it is the quantity passed at the
  call site; "in"/"out"/"NAND" are invariant abbreviations, so
  the one/other forms are identical and the rendered text is
  unchanged. No locale (values-*) entries exist for either name,
  so there were no locale entries to convert and no
  MissingQuantity findings result; untranslated locales fall back
  to the default plurals exactly as they fell back to the default
  strings before. The only call site, SandboxScreen ComponentRow,
  now uses pluralStringResource with R.plurals.

No @SuppressLint added; no lint config or baseline changed.

Verified: /tmp/run-gradle-f-logicgate.sh
:games:logicgate:lintDev :games:logicgate:testDevUnitTest green.
Lint SARIF filtered to games/logicgate/** shows 0 findings
(baseline: 1 NotificationPermission warning + 2 PluralsCandidate
hints); report total is 0 errors with only library/** transitive
warnings/hints remaining. Unit tests: 119 tests, 0 failures,
0 errors, 0 skipped.

Diff

games/logicgate/src/main/AndroidManifest.xml
diff --git a/games/logicgate/src/main/AndroidManifest.xml b/games/logicgate/src/main/AndroidManifest.xmlindex ddc9f64752..5d8bc8cb57 100644--- a/games/logicgate/src/main/AndroidManifest.xml+++ b/games/logicgate/src/main/AndroidManifest.xml@@ -5,6 +5,7 @@     <!-- This app uses no motion/environment sensors; MAOS withholds the -->     <!-- Sensors permission at install instead of auto-granting it. -->     <uses-permission android:name="com.vayunmathur.permission.SENSORS_OPTOUT" />+    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />      <application         android:allowBackup="true"
games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/SandboxScreen.kt
diff --git a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/SandboxScreen.kt b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/SandboxScreen.ktindex d91a13a326..bb400f57c2 100644--- a/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/SandboxScreen.kt+++ b/games/logicgate/src/main/java/com/vayunmathur/games/logicgate/ui/SandboxScreen.kt@@ -10,6 +10,7 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier+import androidx.compose.ui.res.pluralStringResource import androidx.compose.ui.res.stringResource import com.vayunmathur.games.logicgate.R import com.vayunmathur.games.logicgate.platform.ComponentCard@@ -90,8 +91,8 @@ private fun ComponentRow(card: ComponentCard, onOpen: (String) -> Unit) {         Column(Modifier.padding(Spacing.md)) {             Text(card.name, style = MaterialTheme.typography.titleMedium)             Text(-                card.cost?.let { stringResource(R.string.lg_component_summary, card.inputs, card.outputs, it) }-                    ?: stringResource(R.string.lg_component_broken, card.inputs, card.outputs),+                card.cost?.let { pluralStringResource(R.plurals.lg_component_summary, card.outputs, card.inputs, card.outputs, it) }+                    ?: pluralStringResource(R.plurals.lg_component_broken, card.outputs, card.inputs, card.outputs),                 style = MaterialTheme.typography.bodySmall,                 color = MaterialTheme.colorScheme.onSurfaceVariant,             )
games/logicgate/src/main/res/values/strings.xml
diff --git a/games/logicgate/src/main/res/values/strings.xml b/games/logicgate/src/main/res/values/strings.xmlindex 7512255f1c..2d10c732b8 100644--- a/games/logicgate/src/main/res/values/strings.xml+++ b/games/logicgate/src/main/res/values/strings.xml@@ -475,10 +475,16 @@     <string name="lg_component_default_name">Component <xliff:g id="number" example="3">%1$d</xliff:g></string>     <!-- Sandbox list: default group a new component is filed under. Short noun phrase -->     <string name="lg_component_default_group">My components</string>-    <!-- Sandbox list card: pin and cost summary -->-    <string name="lg_component_summary"><xliff:g id="inputs" example="2">%1$d</xliff:g> in · <xliff:g id="outputs" example="1">%2$d</xliff:g> out · <xliff:g id="cost" example="4">%3$d</xliff:g> NAND</string>-    <!-- Sandbox list card: summary when the component cannot be built because it contains itself -->-    <string name="lg_component_broken"><xliff:g id="inputs" example="2">%1$d</xliff:g> in · <xliff:g id="outputs" example="1">%2$d</xliff:g> out · contains itself</string>+    <!-- Sandbox list card: pin and cost summary. Quantity is the output count (%2$d); "in"/"out"/"NAND" are invariant abbreviations, so the forms are identical -->+    <plurals name="lg_component_summary">+        <item quantity="one"><xliff:g id="inputs" example="2">%1$d</xliff:g> in · <xliff:g id="outputs" example="1">%2$d</xliff:g> out · <xliff:g id="cost" example="4">%3$d</xliff:g> NAND</item>+        <item quantity="other"><xliff:g id="inputs" example="2">%1$d</xliff:g> in · <xliff:g id="outputs" example="1">%2$d</xliff:g> out · <xliff:g id="cost" example="4">%3$d</xliff:g> NAND</item>+    </plurals>+    <!-- Sandbox list card: summary when the component cannot be built because it contains itself. Quantity is the output count (%2$d) -->+    <plurals name="lg_component_broken">+        <item quantity="one"><xliff:g id="inputs" example="2">%1$d</xliff:g> in · <xliff:g id="outputs" example="1">%2$d</xliff:g> out · contains itself</item>+        <item quantity="other"><xliff:g id="inputs" example="2">%1$d</xliff:g> in · <xliff:g id="outputs" example="1">%2$d</xliff:g> out · contains itself</item>+    </plurals>     <!-- Component sheet: name field label -->     <string name="lg_component_name">Name</string>     <!-- Component sheet: group field label -->