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:
| Severity | Message | Source file | Line(s) |
|---|
| ⚠️warning | Lines 1-18 are not covered in any test case. | examples/plugins/src/index.ts | 1-18 |
| ⚠️warning | Line 104 is not covered in any test case. | examples/plugins/src/lighthouse/src/lighthouse.plugin.ts | 104 |
| Severity | Message | Source file | Line(s) |
|---|
| 🚨 error | 1st branch is not taken in any test case. | examples/plugins/src/file-size/src/file-size.plugin.ts | 101 |
| 🚨 error | 1st branch is not taken in any test case. | examples/plugins/src/index.ts | 1 |
Problems to be solved:
- git repo could be hosted in GitLab/GitHub/Azure/Bitbucket...
- each Git provider has their own URL structure
- git remove -v should give us origin
- how to detect provider from self-hosted repos? (common for enterprises)
- if we cannot detect provider, then we shouldn't include the link
Acceptance criteria
Example:
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'
functiongenerateGitHubUrl(source: Pick<SourceFileLocation,'file'|'position'>,remoteUrl: string,branch: string): string{const{file, position}=source;const{startLine =0, endLine =0}=position??{};constrepoPath=remoteUrl.match(/github\.com[:/](.+)\.git/)?.[1];constlines=startLine ? `#L${startLine}${endLine ? `-L${endLine}` : ''}` : '';return`https://github.com/${repoPath}/blob/${branch}/${file}${lines}`;}functiongenerateGitLabUrl(source: Pick<SourceFileLocation,'file'|'position'>,remoteUrl: string,branch: string): string{const{file, position}=source;const{startLine =0, endLine =0}=position??{};constrepoPath=remoteUrl.match(/gitlab\.com[:/](.+)\.git/)?.[1];constlines=startLine ? `#L${startLine}${endLine ? `-${endLine}` : ''}` : '';return`https://gitlab.com/${repoPath}/-/blob/${branch}/${file}${lines}`;}Related Issues:
#149
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.tsexamples/plugins/src/lighthouse/src/lighthouse.plugin.tsexamples/plugins/src/file-size/src/file-size.plugin.tsexamples/plugins/src/index.tsProblems to be solved:
Acceptance criteria
remoteUrlto serve users with self-hosted repos. (common for enterprises)Example:
examples/plugins/src/index.tsexamples/plugins/src/lighthouse/src/lighthouse.plugin.tsexamples/plugins/src/file-size/src/file-size.plugin.tsexamples/plugins/src/index.tsImplementation 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:
#149