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

Function formatFileLink

packages/utils/src/lib/reports/formatting.ts:176–194  ·  view source on GitHub ↗
(
  file: string,
  position: SourceFileLocation['position'],
  outputDir: string,
)

Source from the content-addressed store, hash-verified

174}
175
176export function formatFileLink(
177 file: string,
178 position: SourceFileLocation['position'],
179 outputDir: string,
180): string {
181 const relativePath = path.posix.relative(outputDir, file);
182 const env = getEnvironmentType();
183
184 switch (env) {
185 case 'vscode':
186 return position ? `${relativePath}#L${position.startLine}` : relativePath;
187 case 'github':
188 return formatGitHubLink(file, position);
189 case 'gitlab':
190 return formatGitLabLink(file, position);
191 default:
192 return relativePath;
193 }
194}
195
196export function formatSeverityCounts(
197 severityCounts: Partial<Record<IssueSeverity, number>>,

Callers 2

linkToLocalSourceForIdeFunction · 0.85

Calls 3

getEnvironmentTypeFunction · 0.85
formatGitHubLinkFunction · 0.85
formatGitLabLinkFunction · 0.85

Tested by

no test coverage detected