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

Function linkToLocalSourceForIde

packages/utils/src/lib/reports/formatting.ts:103–116  ·  view source on GitHub ↗
(
  source: SourceFileLocation,
  options?: Pick<MdReportOptions, 'outputDir'>,
)

Source from the content-addressed store, hash-verified

101 * linkToLocalSourceInIde({ file: 'src/index.ts' }, { outputDir: '.code-pushup' }) // [`src/index.ts`](../src/index.ts)
102 */
103export function linkToLocalSourceForIde(
104 source: SourceFileLocation,
105 options?: Pick<MdReportOptions, 'outputDir'>,
106): InlineText {
107 const { file, position } = source;
108 const { outputDir } = options ?? {};
109
110 // NOT linkable
111 if (!outputDir) {
112 return md.code(file);
113 }
114
115 return md.link(formatFileLink(file, position, outputDir), md.code(file));
116}
117
118/**
119 * Link to source (handles both file and URL sources)

Callers 2

linkToSourceFunction · 0.85

Calls 1

formatFileLinkFunction · 0.85

Tested by

no test coverage detected