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

Function reformat_files

tests/test_incremental.c:81–105  ·  view source on GitHub ↗

Append "# reformatted" to up to max_files .py files in subdir (cross-platform). */

Source from the content-addressed store, hash-verified

79
80/* Append "# reformatted" to up to max_files .py files in subdir (cross-platform). */
81static int reformat_files(const char *subdir, int max_files) {
82 char dir[512];
83 snprintf(dir, sizeof(dir), "%s/%s", g_repodir, subdir);
84 cbm_dir_t *d = cbm_opendir(dir);
85 if (!d) {
86 return -1;
87 }
88 cbm_dirent_t *entry;
89 int count = 0;
90 while ((entry = cbm_readdir(d)) != NULL && count < max_files) {
91 size_t nlen = strlen(entry->name);
92 if (nlen < 4 || strcmp(entry->name + nlen - 3, ".py") != 0) {
93 continue;
94 }
95 if (entry->is_dir) {
96 continue;
97 }
98 char path[1024];
99 snprintf(path, sizeof(path), "%s/%s", dir, entry->name);
100 th_append_file(path, "# reformatted\n");
101 count++;
102 }
103 cbm_closedir(d);
104 return 0;
105}
106
107static char *index_repo(void) {
108 char args[512];

Callers 1

test_incremental.cFile · 0.85

Calls 4

cbm_opendirFunction · 0.85
cbm_readdirFunction · 0.85
th_append_fileFunction · 0.85
cbm_closedirFunction · 0.85

Tested by

no test coverage detected