bibipkins / dotnet-test-reporter

A GitHub action to parse test results and post the summary as a PR comment
MIT License
19 stars 9 forks source link

Code Complexity #24

Closed tmonck closed 1 year ago

tmonck commented 1 year ago

I was looking into a few different GHA that do test reporting. I like the output of this one the most but found it lacking the parsing/printing of the Code Complexity that is in some of the test output formats. Is this a feature you would be interested in supporting?

bibipkins commented 1 year ago

Hey @tmonck , thanks for checking out this action! Yes the code complexity definitely sounds interesting. I don't have much experience with calculating this sort of metric myself but I will look into it.

tmonck commented 1 year ago

I can look into it as well. I do know there is the complexity attribute in the xml just like branch and coverage, at least with the cobertura format.

bibipkins commented 1 year ago

@tmonck awesome! As I see it, as a starting point, complexity feature could be included just for the cobertura format. We can have complexity set to 0 for opencover, and in that case, if complexity is 0 we can just not show it =) Later it can be expanded by calculating the complexity manually, parsing through classes/methods/branches of a coverage file Where do you think it would fit to be displayed? In the comment, in the action summary, both?

bibipkins commented 1 year ago

if you have some ideas feel free to open a PR. When PR is created you can see how the comment and summary will look, since action is self-running on the repo

tmonck commented 1 year ago

I was thinking it's worth being in the table on the summary, but wanted to gauge with you as well. I'll gladly take a stab at it and open a PR.

bibipkins commented 1 year ago

sounds good!

tmonck commented 1 year ago

Screenshot from 2023-05-23 20-40-41 Here is a quick preview of what I had in mind. The number in the parenthesis is the complexity for the Project and then I included it for each file.

I'm thinking about adding the ability to hide it and setting it true by default since opencover won't be supported out of the gate.

tmonck commented 1 year ago

So I added support for opencover really quick. Do you think having the ability to hide the complexity would be desired by your consumers of this action? As of now in the PR I opened I have not hidden it even when it's equals 0 in value.

bibipkins commented 1 year ago

@tmonck sorry, had to merge your PR into another branch and then open a PR into main. Github Actions have issues with using github token when PR is opened using forked repository https://github.com/actions/first-interaction/issues/10 Complexity looks perfect https://github.com/bibipkins/dotnet-test-reporter/actions/runs/5085103838#summary-13771267094

tmonck commented 1 year ago

No worries at all. I found that same issue after you comment on the PR. Only thing missing in case you want it added was the hiding of complexity when it was 0.

bibipkins commented 1 year ago

@tmonck it works for both coverage types so its fine. If you have anything else to add to this feature feel free to reopen the issue. Thank you for your contribution!