Commit 8382e94
Improve doctor async checks: better error handling and comment filtering
Addressed code review feedback to make the async usage detection more
robust and accurate:
1. Enhanced error handling:
- Replace broad StandardError catches with specific exceptions
(Errno::ENOENT, Encoding::InvalidByteSequenceError,
Encoding::UndefinedConversionError)
- Add debug logging when errors occur (if Rails logger available)
2. Add comment filtering to reduce false positives:
- Filter out commented Ruby lines in config files (lines starting with #)
- Skip ERB comments (<%# ... %>), HAML comments (-# ...), and HTML
comments (<!-- ... -->) in view files
- Prevent false alarms from commented-out code
3. Refactor for code quality:
- Extract scan_pattern_for_async and file_has_async_pack_tag? helpers
- Reduce cyclomatic complexity in scan_view_files_for_async_pack_tag
- All RuboCop checks pass
4. Expand test coverage:
- Add tests for ERB, HAML, and HTML comment scenarios
- Add test for commented config with async strategy
- All 13 async-related tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 044d7de commit 8382e94
File tree
2 files changed
+102
-17
lines changed- lib/react_on_rails
- spec/lib/react_on_rails
2 files changed
+102
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1181 | 1181 | | |
1182 | 1182 | | |
1183 | 1183 | | |
1184 | | - | |
1185 | | - | |
1186 | | - | |
1187 | 1184 | | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
1188 | 1192 | | |
1189 | | - | |
1190 | | - | |
1191 | | - | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
1192 | 1196 | | |
1193 | | - | |
1194 | | - | |
1195 | | - | |
1196 | | - | |
1197 | | - | |
1198 | | - | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
1199 | 1221 | | |
1200 | 1222 | | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
| 1223 | + | |
1204 | 1224 | | |
1205 | 1225 | | |
1206 | 1226 | | |
| |||
1209 | 1229 | | |
1210 | 1230 | | |
1211 | 1231 | | |
1212 | | - | |
1213 | | - | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
1214 | 1239 | | |
1215 | 1240 | | |
1216 | 1241 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
310 | 358 | | |
311 | 359 | | |
312 | 360 | | |
| |||
343 | 391 | | |
344 | 392 | | |
345 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
346 | 406 | | |
347 | 407 | | |
0 commit comments