code-pushup / cli

A CLI to run all kinds of code quality measurements to align your team with company goals
https://code-pushup.dev
MIT License
185 stars 11 forks source link

Issues sections should link to local file in your IDE at given commit with highlighted line(s) #745

Open BioPhoton opened 1 month ago

BioPhoton commented 1 month ago

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. src/lib/index.ts 1-18
⚠️ warning Line 104 is not covered in any test case. src/lib/index.ts 104
Severity Message Source file Line(s)
🚨 error 1st branch is not taken in any test case. src/lib/index.ts 101
🚨 error 1st branch is not taken in any test case. src/lib/index.ts 1

Acceptance criteria

Folder:

/
├── .code-pushup
│   └── report.json
└── src
    └── lib
        └── index.ts

Link in report:
[src/lib/index.ts](../src/lib/index.ts)

Example Report:

Severity Message Source file Line(s)
⚠️ warning Lines 1-18 are not covered in any test case. src/lib/index.ts 1-18
⚠️ warning Line 104 is not covered in any test case. src/lib/index.ts 104
Severity Message Source file Line(s)
🚨 error 1st branch is not taken in any test case. src/lib/index.ts 101
🚨 error 1st branch is not taken in any test case. src/lib/index.ts 1

Implementation details

Essential logic and tests are present in the following PR, the over all configuration handling is not fully thought through.

https://github.com/code-pushup/cli/tree/add-link-to-local-filesystem-in-reports

Related Issues:

https://github.com/code-pushup/cli/issues/149

matejchalk commented 1 month ago

Should we close https://github.com/code-pushup/cli/issues/722? What happens in CI? Should the CVS server get considered in the desinge decision?

We don't print issues in the CLI output (it would be way too much info), so I don't see that there's anything to consider about CI.

CI jobs may produce the Markdown artifacts, but artifacts' content isn't viewable online anyway, you have to download the file and open it - probably in your IDE :grin: So local path links should still cover most use cases, I think.

BioPhoton commented 1 month ago

The thought was driven by the fact that ppl could store the report in the repo or add it to a pr.

I started to elaborate it here #748