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

Function reformat_files

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

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