MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / policy_of

Function policy_of

tests/test_test_impact.c:2386–2401  ·  view source on GitHub ↗

Policies consume the exact query-local snapshot and classify paths before * target applicability is known. */

Source from the content-addressed store, hash-verified

2384/* Policies consume the exact query-local snapshot and classify paths before
2385 * target applicability is known. */
2386static cbm_test_policy_t *policy_of(const char *body) {
2387 char dir[512], path[600];
2388 snprintf(dir, sizeof(dir), "%s/cbm-impact-policy-XXXXXX", cbm_tmpdir());
2389 if (!cbm_mkdtemp(dir))
2390 return NULL;
2391 snprintf(path, sizeof(path), "%s/config.json", dir);
2392 cbm_test_policy_t *policy = NULL;
2393 if (th_write_file(path, body) == 0) {
2394 cbm_test_config_t *config = cbm_test_config_load(path, false);
2395 if (config)
2396 policy = cbm_test_policy_new(config);
2397 cbm_test_config_free(config);
2398 }
2399 th_rmtree(dir);
2400 return policy;
2401}
2402
2403static bool policy_matches(const cbm_test_policy_t *policy, const char *path, const char *id) {
2404 const cbm_test_rule_t *rule = NULL;

Callers 1

test_test_impact.cFile · 0.85

Calls 7

cbm_tmpdirFunction · 0.85
cbm_mkdtempFunction · 0.85
th_write_fileFunction · 0.85
cbm_test_config_loadFunction · 0.85
cbm_test_policy_newFunction · 0.85
cbm_test_config_freeFunction · 0.85
th_rmtreeFunction · 0.85

Tested by

no test coverage detected