MCPcopy Create free account
hub / github.com/cometchat/cometchat-uikit-angular / auditComponent

Function auditComponent

scripts/docs-audit.ts:293–366  ·  view source on GitHub ↗

* Audits a single component by comparing source declarations against documentation.

(dirPath: string)

Source from the content-addressed store, hash-verified

291 * Audits a single component by comparing source declarations against documentation.
292 */
293function auditComponent(dirPath: string): ComponentAuditEntry {
294 const dirName = path.basename(dirPath);
295 const componentFilePath = path.join(dirPath, `${dirName}.component.ts`);
296
297 // Extract source declarations
298 const sourceInputs = extractInputs(componentFilePath);
299 const sourceOutputs = extractOutputs(componentFilePath);
300
301 // Find corresponding doc file
302 const docFilePath = findDocFile(dirName);
303
304 if (!docFilePath) {
305 return {
306 name: dirName,
307 status: 'missing',
308 docFile: null,
309 sourceInputs,
310 sourceOutputs,
311 documentedInputs: [],
312 documentedOutputs: [],
313 missingInputs: sourceInputs,
314 missingOutputs: sourceOutputs,
315 staleInputs: [],
316 staleOutputs: [],
317 };
318 }
319
320 const relativeDocPath = path.relative(process.cwd(), docFilePath);
321
322 // Extract documented entries
323 const documentedInputs = extractDocumentedInputs(docFilePath);
324 const documentedOutputs = extractDocumentedOutputs(docFilePath);
325
326 // Find missing: in source but not in docs
327 const missingInputs = sourceInputs.filter(
328 (input) => !documentedInputs.includes(input)
329 );
330 const missingOutputs = sourceOutputs.filter(
331 (output) => !documentedOutputs.includes(output)
332 );
333
334 // Find stale: in docs but not in source
335 const staleInputs = documentedInputs.filter(
336 (input) => !sourceInputs.includes(input)
337 );
338 const staleOutputs = documentedOutputs.filter(
339 (output) => !sourceOutputs.includes(output)
340 );
341
342 // Classify status
343 const hasGaps =
344 missingInputs.length > 0 ||
345 missingOutputs.length > 0 ||
346 staleInputs.length > 0 ||
347 staleOutputs.length > 0;
348
349 const status: ComponentAuditEntry['status'] = hasGaps
350 ? 'partially-documented'

Callers

nothing calls this directly

Calls 5

extractOutputsFunction · 0.85
findDocFileFunction · 0.85
extractDocumentedInputsFunction · 0.85
extractDocumentedOutputsFunction · 0.85
extractInputsFunction · 0.70

Tested by

no test coverage detected