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

Function main

graph-ui/tools/style-gate.mjs:150–284  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148const quoteExempt = (path) => path.startsWith('verification/') && path.endsWith('.json');
149
150async function main() {
151 const args = process.argv.slice(2);
152 let out = DEFAULT_OUT;
153 for (let i = 0; i < args.length; i += 1) {
154 if (args[i] === '--out') {
155 out = resolve(args[i + 1]);
156 i += 1;
157 }
158 }
159
160 /*
161 * Der eigene Bericht wird nicht gelesen.
162 *
163 * Er enthaelt woertlich die Zeilen, die dieser Lauf anderswo gefunden hat,
164 * also faende der naechste Lauf jede Fundstelle ein zweites Mal, diesmal in
165 * einem Zitat. Das waere keine zweite Beobachtung, sondern dieselbe, und
166 * eine Ausnahme fuer eine erzeugte Datei versteckt nichts: was in ihr steht,
167 * steht auch in der Datei, aus der sie es abgeschrieben hat.
168 *
169 * Das gilt auch fuer den eingecheckten Bericht am Standardort, wenn --out
170 * woanders hin schreibt: er ist ein frueherer Lauf desselben Werkzeugs.
171 */
172 const selfReport = relative(ROOT, out);
173 const ownReports = new Set([selfReport, relative(ROOT, DEFAULT_OUT)]);
174 const files = (await repositoryFiles()).filter((path) => !ownReports.has(path));
175 const dashHits = [];
176 const dashExceptions = [];
177 const attributionHits = [];
178 const attributionExceptions = [];
179 const patternHits = [];
180 let textFiles = 0;
181 let binaryFiles = 0;
182
183 for (const path of files) {
184 const text = await textOf(path);
185 if (text === null) {
186 binaryFiles += 1;
187 continue;
188 }
189 textFiles += 1;
190 const lines = text.split('\n');
191 for (let index = 0; index < lines.length; index += 1) {
192 const line = lines[index];
193 const where = { file: path, line: index + 1, text: line.trim().slice(0, 160) };
194
195 if (LONG_DASH.test(line)) {
196 if (quoteExempt(path)) {
197 dashExceptions.push({ ...where, reason: QUOTE_REASON });
198 } else {
199 dashHits.push(where);
200 }
201 }
202
203 for (const { name, pattern } of ATTRIBUTION_PATTERNS) {
204 if (pattern.test(line)) {
205 patternHits.push({ ...where, pattern: name });
206 }
207 }

Callers 1

style-gate.mjsFile · 0.70

Calls 7

scanChromeFunction · 0.90
repositoryFilesFunction · 0.70
textOfFunction · 0.70
quoteExemptFunction · 0.70
logFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected