| 7030 | } |
| 7031 | |
| 7032 | static const char *coverage_status(const cbm_coverage_row_t *rows, int count, |
| 7033 | const char *requested_path, const char *recording_status, |
| 7034 | bool generation_matches, bool lookup_ok, |
| 7035 | bool exact_path_verified) { |
| 7036 | if (!lookup_ok) { |
| 7037 | return "coverage_unavailable"; |
| 7038 | } |
| 7039 | bool exact = false; |
| 7040 | for (int i = 0; i < count; i++) { |
| 7041 | if (rows[i].rel_path && strcmp(rows[i].rel_path, requested_path) == 0) { |
| 7042 | exact = true; |
| 7043 | break; |
| 7044 | } |
| 7045 | } |
| 7046 | for (int pass = 0; pass < 3; pass++) { |
| 7047 | for (int i = 0; i < count; i++) { |
| 7048 | if (exact && (!rows[i].rel_path || strcmp(rows[i].rel_path, requested_path) != 0)) { |
| 7049 | continue; |
| 7050 | } |
| 7051 | const char *kind = rows[i].kind ? rows[i].kind : ""; |
| 7052 | /* "parse_unusable" must be named here. Without its own case it |
| 7053 | * falls through to the catch-all below and reports "skipped", |
| 7054 | * which is wrong in the way that matters: the file WAS indexed. */ |
| 7055 | if (pass == 0 && strcmp(kind, "parse_unusable") == 0) { |
| 7056 | return "unusable"; |
| 7057 | } |
| 7058 | if (pass == 0 && strcmp(kind, "parse_partial") == 0) { |
| 7059 | return "partial"; |
| 7060 | } |
| 7061 | if (pass == 1 && strncmp(kind, "not_indexed", 11) == 0) { |
| 7062 | return "excluded"; |
| 7063 | } |
| 7064 | if (pass == 2 && kind[0]) { |
| 7065 | return "skipped"; |
| 7066 | } |
| 7067 | } |
| 7068 | } |
| 7069 | bool recording_complete = recording_status && strcmp(recording_status, "complete") == 0; |
| 7070 | bool truncated_exact_path_verified = |
| 7071 | exact_path_verified && recording_status && strcmp(recording_status, "truncated") == 0; |
| 7072 | if (!generation_matches || (!recording_complete && !truncated_exact_path_verified)) { |
| 7073 | return "coverage_unavailable"; |
| 7074 | } |
| 7075 | return "no_recorded_issue"; |
| 7076 | } |
| 7077 | |
| 7078 | static const char *coverage_recommended_action(const char *status, const char *freshness) { |
| 7079 | if (!freshness || strcmp(freshness, "metadata_match") != 0) { |
no outgoing calls
no test coverage detected