Open BioPhoton opened 2 weeks ago
As a user of the CLI I want to have click through experience for all actionable feedback a get from the audit issues.
At the moment the provided issues often show exactly where the error needs to get fixed, but a manual navigation to the line of code is required.
Example:
examples/plugins/src/index.ts
examples/plugins/src/lighthouse/src/lighthouse.plugin.ts
examples/plugins/src/file-size/src/file-size.plugin.ts
remoteUrl
Get remote from current git: git remote -> 'origin'
git remote
Get remote url from current git: git remote get-url origin -> 'git@github.com:code-pushup/cli.git'
git remote get-url origin
function generateGitHubUrl(source: Pick<SourceFileLocation, 'file' | 'position'>, remoteUrl: string, branch: string): string { const {file, position} = source; const {startLine = 0, endLine = 0} = position ?? {}; const repoPath = remoteUrl.match(/github\.com[:/](.+)\.git/)?.[1]; const lines = startLine ? `#L${startLine}${endLine ? `-L${endLine}` : ''}` : ''; return `https://github.com/${repoPath}/blob/${branch}/${file}${lines}`; } function generateGitLabUrl(source: Pick<SourceFileLocation, 'file' | 'position'>, remoteUrl: string, branch: string): string { const {file, position} = source; const {startLine = 0, endLine = 0} = position ?? {}; const repoPath = remoteUrl.match(/gitlab\.com[:/](.+)\.git/)?.[1]; const lines = startLine ? `#L${startLine}${endLine ? `-${endLine}` : ''}` : ''; return `https://gitlab.com/${repoPath}/-/blob/${branch}/${file}${lines}`; }
Related Issues:
https://github.com/code-pushup/cli/issues/149
@BioPhoton please rework this issue to just link to the local source example: src/index.ts
User story
As a user of the CLI I want to have click through experience for all actionable feedback a get from the audit issues.
At the moment the provided issues often show exactly where the error needs to get fixed, but a manual navigation to the line of code is required.
Example:
examples/plugins/src/index.ts
examples/plugins/src/lighthouse/src/lighthouse.plugin.ts
examples/plugins/src/file-size/src/file-size.plugin.ts
examples/plugins/src/index.ts
Acceptance criteria
remoteUrl
to serve users with self-hosted repos. (common for enterprises)Example:
examples/plugins/src/index.ts
examples/plugins/src/lighthouse/src/lighthouse.plugin.ts
examples/plugins/src/file-size/src/file-size.plugin.ts
examples/plugins/src/index.ts
Implementation details
Get remote from current git:
git remote
-> 'origin'Get remote url from current git:
git remote get-url origin
-> 'git@github.com:code-pushup/cli.git'Related Issues:
https://github.com/code-pushup/cli/issues/149