Commit 0f20f60
refactor: clear three SonarQube smells, and pin what one of them exposed
schedule1/index.tsx L414/L422 — two three-deep nested ternaries extracted into
named helpers with early returns. Sonar is right that these were confusing, and
in a specific way: they hid that `derived` has the OPPOSITE precedence in the two
figures. For cost, the mirror changes exactly one of three branches (only 140);
for the rate, it supersedes every row including 139 and 140. Same two codes,
opposite answer — legitimately, because deriveSchedule1 computes a rate for 139
(its volume is user-entered) but no cost for it (the cost is a Schedule 3 pull).
Now stated in a comment instead of implied by nesting depth.
That refactor turned up a coverage gap: inverting the rate precedence left all
268 schedule1 tests green, so the rule was pinned by nothing. Added a test that
asserts 139's rate moves with an entered volume while its cost stays the
Schedule 3 pull — mutation-verified, it fails on the inversion.
schedule5SubPage/derived.ts L71 — `stampedVolume ?? null` becomes a defaulted
`volume` parameter. Equivalent: a default fires only on `undefined`, and every
call site passing an explicit `null` already wanted `null`.
No behaviour change intended in any of the three. Suite 1291/1293 (two timeout
flakes, both pass in isolation), zero unhandled errors, build clean, and zero
type errors in the touched files against an origin/main baseline.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent e666ac8 commit 0f20f60
3 files changed
Lines changed: 58 additions & 20 deletions
File tree
- frontend/src/components
- schedule1
- __tests__
- schedule5SubPage
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
174 | 202 | | |
175 | 203 | | |
176 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
404 | 428 | | |
405 | 429 | | |
406 | 430 | | |
407 | 431 | | |
408 | 432 | | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
| 433 | + | |
| 434 | + | |
427 | 435 | | |
428 | 436 | | |
429 | 437 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | | - | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
0 commit comments