Check whether every statement in the body is a pure output statement (`echo`, `print`, `printf`, `var_dump`, `print_r`, `var_export`).
(body: &str)
| 625 | /// Check whether every statement in the body is a pure output statement |
| 626 | /// (`echo`, `print`, `printf`, `var_dump`, `print_r`, `var_export`). |
| 627 | fn is_pure_output(body: &str) -> bool { |
| 628 | let trimmed = body.trim(); |
| 629 | if trimmed.is_empty() { |
| 630 | return false; |
| 631 | } |
| 632 | |
| 633 | for line in trimmed.lines() { |
| 634 | let line = line.trim().trim_end_matches(';').trim(); |
| 635 | if line.is_empty() || line.starts_with("//") || line.starts_with('#') { |
| 636 | continue; |
| 637 | } |
| 638 | if !is_output_line(line) { |
| 639 | return false; |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | true |
| 644 | } |
| 645 | |
| 646 | /// Check whether the body *ends* with one or more output statements |
| 647 | /// but also contains non-output setup lines (assignments, calls, etc.). |
no test coverage detected