Commit da6496b
fix(schedule10): resolve SonarCloud findings on PR #305
All three gate failures fixed, plus the warnings worth acting on.
TRANSACTIONAL SELF-INVOCATION (6 failures). Each of the seven write methods and
checkStatus called getSchedule10 via this, and a this-call never passes through
the Spring proxy -- so that method's @transactional was silently ignored and its
reads simply joined the caller's transaction. The behaviour was correct; the
annotation was not what made it so. The assembly body is extracted into a
private, un-annotated assembleDocument(...) that every entry point calls, so the
transaction is opened by the entry point and nothing self-invokes. The class
javadoc previously admitted this subtlety in prose; the code now states it.
DUPLICATED LITERALS (2 failures). "percentageConverterErrorMsg" appeared five
times across the new Schedule 10 converter entries and is now the constant
PERCENTAGE_CONVERTER. "999.9" appeared three times as the upper bound of the
one-decimal width and distance rules and is now WIDTH_MAX.
MONSTER CLASS (warning, 21 dependencies against a limit of 20). The two exception
types added by the code review pushed the count over. Rather than suppress it,
the single-argument persist(Runnable) overload turned out to be dead: once every
one of the seven call sites carried a resource-specific message key, nothing
reached the generic form. Removing it deletes dead code and drops the
ScheduleNotSavedException dependency back to 20.
COMMENTED-OUT CODE (warning). This was the deliberate 52B demotion from the code
review -- a commented-out case label kept as a record. Reworded as prose so the
reasoning survives without a commented-out statement.
WEAK ASSERTION (warning). assertThat(keysOf(issues)).contains(
"missingRequiredFieldMsg") was satisfied by any of the eight issues in that
outcome, so it never bound the key to the Material Code Type field. The code
review had flagged the same line independently. It now asserts the key on
ballastMaterialCode specifically and pins the exact ordered set with
containsExactly. The keysOf helper became unused and is removed.
ASSERTION STYLE (warnings). 24 assertThat(map.get(k)).isEqualTo(v) forms rewritten
as assertThat(map).containsEntry(k, v). Multi-line forms and those carrying an
.as(...) description were left alone deliberately.
Also rebased onto main, which had moved twice: the second move bumped checkstyle
from 13.9.0 to 13.10.0 and touched backend/. That exposed a hole in the local
verification -- the checkstyle gate had been run with -o (offline), so after the
version bump it failed to resolve the plugin and never actually ran. Re-run
online against 13.10.0: 0 violations in schedule10 (1235 pre-existing elsewhere,
up from 1234 through main's own new code).
Verification: 1150 unit + 879 integration tests, 0 failures.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent ba6c89a commit da6496b
8 files changed
Lines changed: 94 additions & 76 deletions
File tree
- backend/src
- main/java/ca/bc/gov/nrs/ilcr
- exception
- schedule10
- test/java/ca/bc/gov/nrs/ilcr/schedule10
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
323 | 326 | | |
324 | 327 | | |
325 | 328 | | |
| |||
330 | 333 | | |
331 | 334 | | |
332 | 335 | | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
338 | 341 | | |
339 | 342 | | |
340 | 343 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| |||
216 | 218 | | |
217 | 219 | | |
218 | 220 | | |
219 | | - | |
| 221 | + | |
220 | 222 | | |
221 | 223 | | |
222 | 224 | | |
| |||
255 | 257 | | |
256 | 258 | | |
257 | 259 | | |
258 | | - | |
| 260 | + | |
259 | 261 | | |
260 | 262 | | |
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
264 | 266 | | |
265 | | - | |
| 267 | + | |
266 | 268 | | |
267 | 269 | | |
268 | 270 | | |
| |||
Lines changed: 43 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
143 | 164 | | |
144 | 165 | | |
145 | 166 | | |
| |||
513 | 534 | | |
514 | 535 | | |
515 | 536 | | |
516 | | - | |
| 537 | + | |
517 | 538 | | |
518 | 539 | | |
519 | 540 | | |
| |||
549 | 570 | | |
550 | 571 | | |
551 | 572 | | |
552 | | - | |
| 573 | + | |
553 | 574 | | |
554 | 575 | | |
555 | 576 | | |
| |||
581 | 602 | | |
582 | 603 | | |
583 | 604 | | |
584 | | - | |
| 605 | + | |
585 | 606 | | |
586 | 607 | | |
587 | 608 | | |
| |||
611 | 632 | | |
612 | 633 | | |
613 | 634 | | |
614 | | - | |
| 635 | + | |
615 | 636 | | |
616 | 637 | | |
617 | 638 | | |
| |||
642 | 663 | | |
643 | 664 | | |
644 | 665 | | |
645 | | - | |
| 666 | + | |
646 | 667 | | |
647 | 668 | | |
648 | 669 | | |
| |||
681 | 702 | | |
682 | 703 | | |
683 | 704 | | |
684 | | - | |
| 705 | + | |
685 | 706 | | |
686 | 707 | | |
687 | 708 | | |
| |||
705 | 726 | | |
706 | 727 | | |
707 | 728 | | |
708 | | - | |
| 729 | + | |
709 | 730 | | |
710 | 731 | | |
711 | 732 | | |
| |||
726 | 747 | | |
727 | 748 | | |
728 | 749 | | |
729 | | - | |
| 750 | + | |
730 | 751 | | |
731 | 752 | | |
732 | 753 | | |
| |||
1079 | 1100 | | |
1080 | 1101 | | |
1081 | 1102 | | |
1082 | | - | |
| 1103 | + | |
1083 | 1104 | | |
1084 | 1105 | | |
1085 | 1106 | | |
1086 | | - | |
1087 | | - | |
1088 | | - | |
1089 | | - | |
1090 | | - | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
1095 | | - | |
1096 | | - | |
1097 | | - | |
1098 | 1107 | | |
1099 | | - | |
1100 | | - | |
1101 | | - | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
1102 | 1112 | | |
1103 | 1113 | | |
1104 | 1114 | | |
| |||
Lines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | 79 | | |
84 | 80 | | |
85 | 81 | | |
| |||
286 | 282 | | |
287 | 283 | | |
288 | 284 | | |
289 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
290 | 288 | | |
291 | 289 | | |
292 | 290 | | |
293 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
294 | 297 | | |
295 | 298 | | |
296 | 299 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
| 80 | + | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
| 197 | + | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
0 commit comments