A remote method has no declaration in the importer/raw file registry. Its * source=lsp edge proves that cross-file registry evidence reached resolution. */
| 627 | /* A remote method has no declaration in the importer/raw file registry. Its |
| 628 | * source=lsp edge proves that cross-file registry evidence reached resolution. */ |
| 629 | static bool cx_pyrange_controls(cbm_store_t *store, const char *project, const cbm_node_t *caller) { |
| 630 | if (!caller->qualified_name || !caller->file_path) |
| 631 | return false; |
| 632 | const char *dot = strrchr(caller->qualified_name, '.'); |
| 633 | if (!dot || dot - caller->qualified_name > 1000) |
| 634 | return false; |
| 635 | char module[1200], qn[1400]; |
| 636 | int n = snprintf(module, sizeof(module), "%.*s", (int)(dot - caller->qualified_name), |
| 637 | caller->qualified_name); |
| 638 | if (n < 0 || (size_t)n >= sizeof(module)) |
| 639 | return false; |
| 640 | n = snprintf(qn, sizeof(qn), "%s.cx_pyrange_definition_0", module); |
| 641 | bool function = |
| 642 | n >= 0 && (size_t)n < sizeof(qn) && |
| 643 | cx_pyrange_exact_control(store, project, caller, qn, caller->file_path, "Function"); |
| 644 | n = snprintf(qn, sizeof(qn), "%s.RangeClass_0.value", module); |
| 645 | bool method = n >= 0 && (size_t)n < sizeof(qn) && |
| 646 | cx_pyrange_exact_control(store, project, caller, qn, caller->file_path, "Method"); |
| 647 | int m = -1, j = -1; |
| 648 | if (sscanf(caller->file_path, "pyrange/mod%d/p%d/__init__.py", &m, &j) != 2 || m < 0 || j < 0 || |
| 649 | j >= CX_PYRANGE_FILES_PER_K) |
| 650 | return false; |
| 651 | char path[1200], slot_name[64]; |
| 652 | n = snprintf(path, sizeof(path), "pyrange/mod%d/p%d/__init__.py", m, j); |
| 653 | if (n < 0 || (size_t)n >= sizeof(path) || strcmp(path, caller->file_path) != 0) |
| 654 | return false; |
| 655 | n = snprintf(slot_name, sizeof(slot_name), "p%d", j); |
| 656 | char *slot = strrchr(module, '.'); |
| 657 | if (n < 0 || (size_t)n >= sizeof(slot_name) || !slot || strcmp(slot + 1, slot_name) != 0) |
| 658 | return false; |
| 659 | *slot = '\0'; |
| 660 | int peer = (j + 1) % CX_PYRANGE_FILES_PER_K; |
| 661 | n = snprintf(qn, sizeof(qn), "%s.p%d.Peer_%d_%d.remote_%d_%d", module, peer, m, peer, m, peer); |
| 662 | int pn = snprintf(path, sizeof(path), "pyrange/mod%d/p%d/__init__.py", m, peer); |
| 663 | bool remote = n >= 0 && (size_t)n < sizeof(qn) && pn >= 0 && (size_t)pn < sizeof(path) && |
| 664 | strcmp(path, caller->file_path) != 0 && |
| 665 | cx_pyrange_exact_control(store, project, caller, qn, path, "Method"); |
| 666 | return function && method && remote; |
| 667 | } |
| 668 | |
| 669 | static bool cx_pyrange_population(cbm_store_t *store, const char *project, CxMetrics *out) { |
| 670 | static const char *const labels[] = {"File", "Function", "Class"}; |
no test coverage detected