MCPcopy Create free account
hub / github.com/openai/plugins / analyzeCoverageArtifacts

Function analyzeCoverageArtifacts

plugins/plugin-eval/src/evaluators/coverage.js:99–180  ·  view source on GitHub ↗
(rootPath)

Source from the content-addressed store, hash-verified

97}
98
99export async function analyzeCoverageArtifacts(rootPath) {
100 const checks = [];
101 const metrics = [];
102 const artifacts = [];
103 const coverageFiles = await findCoverageFiles(rootPath);
104
105 metrics.push(
106 createMetric({
107 id: "coverage_artifact_count",
108 category: "coverage",
109 value: coverageFiles.length,
110 unit: "files",
111 band: coverageFiles.length > 0 ? "good" : "info",
112 }),
113 );
114
115 if (coverageFiles.length === 0) {
116 checks.push(
117 createCheck({
118 id: "coverage-artifacts-unavailable",
119 category: "coverage",
120 severity: "info",
121 status: "info",
122 message: "No coverage artifacts were found for this target.",
123 evidence: [relativePath(process.cwd(), rootPath)],
124 remediation: ["Generate `lcov.info`, `coverage.xml`, or an Istanbul coverage JSON file if you want coverage scoring."],
125 }),
126 );
127 return { checks, metrics, artifacts };
128 }
129
130 const fileSummaries = [];
131 for (const filePath of coverageFiles) {
132 const coverage = await parseCoverageFile(filePath);
133 if (coverage != null) {
134 fileSummaries.push({
135 path: relativePath(rootPath, filePath),
136 coverage,
137 });
138 }
139 }
140
141 if (fileSummaries.length > 0) {
142 const bestCoverage = Math.max(...fileSummaries.map((item) => item.coverage));
143 metrics.push(
144 createMetric({
145 id: "coverage_percent",
146 category: "coverage",
147 value: bestCoverage,
148 unit: "percent",
149 band: bestCoverage >= 85 ? "good" : bestCoverage >= 70 ? "moderate" : "heavy",
150 }),
151 );
152 if (bestCoverage < 70) {
153 checks.push(
154 createCheck({
155 id: "coverage-low",
156 category: "coverage",

Callers 2

analyzePathFunction · 0.90

Calls 7

createMetricFunction · 0.90
createCheckFunction · 0.90
relativePathFunction · 0.90
createArtifactFunction · 0.90
findCoverageFilesFunction · 0.85
parseCoverageFileFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected