MCPcopy Create free account
hub / github.com/code-pushup/cli / collect

Function collect

packages/core/src/lib/implementation/collect.ts:26–57  ·  view source on GitHub ↗
(options: CollectOptions)

Source from the content-addressed store, hash-verified

24 * @param options
25 */
26export async function collect(options: CollectOptions): Promise<Report> {
27 const { plugins, categories, persist = {}, cache } = options;
28
29 const date = new Date().toISOString();
30 const start = performance.now();
31 const packageJson = createRequire(import.meta.url)(
32 '../../../package.json',
33 ) as typeof import('../../../package.json');
34
35 const commit = await getLatestCommit();
36 logger.debug(
37 commit
38 ? `Found latest commit ${commit.hash} ("${commit.message}" by ${commit.author})`
39 : 'Latest commit not found',
40 );
41
42 logger.info(
43 `Collecting report from ${pluralizeToken('plugin', plugins.length)} ...`,
44 );
45 const pluginOutputs = await executePlugins({ plugins, persist, cache });
46 logger.info(ansis.green('Collected report ✓'));
47
48 return {
49 commit,
50 packageName: packageJson.name,
51 version: packageJson.version,
52 date,
53 duration: calcDuration(start),
54 categories,
55 plugins: pluginOutputs,
56 };
57}

Callers 2

collectAndPersistReportsFunction · 0.85

Calls 6

getLatestCommitFunction · 0.90
pluralizeTokenFunction · 0.90
calcDurationFunction · 0.90
executePluginsFunction · 0.85
infoMethod · 0.80
debugMethod · 0.45

Tested by

no test coverage detected