( file: string, position: SourceFileLocation['position'], )
| 141 | } |
| 142 | |
| 143 | export function formatGitHubLink( |
| 144 | file: string, |
| 145 | position: SourceFileLocation['position'], |
| 146 | ): string { |
| 147 | const baseUrl = getGitHubBaseUrl(); |
| 148 | if (!position) { |
| 149 | return `${baseUrl}/${file}`; |
| 150 | } |
| 151 | const { startLine, endLine, startColumn, endColumn } = position; |
| 152 | const start = startColumn ? `L${startLine}C${startColumn}` : `L${startLine}`; |
| 153 | const end = endLine |
| 154 | ? endColumn |
| 155 | ? `L${endLine}C${endColumn}` |
| 156 | : `L${endLine}` |
| 157 | : ''; |
| 158 | const lineRange = end && start !== end ? `${start}-${end}` : start; |
| 159 | return `${baseUrl}/${file}#${lineRange}`; |
| 160 | } |
| 161 | |
| 162 | export function formatGitLabLink( |
| 163 | file: string, |
no test coverage detected