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

Function reformat_files

tests/test_incremental.c:82–106  ·  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

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