-
-
Notifications
You must be signed in to change notification settings - Fork 290
Color Method Links to Match their Coverage Percent #348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I will have a look at this within the next days. |
Thank you for looking at this enhancement request already. You have a more generic way of calculating method / property coverage, which is great! I also like the look of the vertical bars much better than coloring the method name. I pulled your 4.6.0 branch and so far I see either 0% or 100% for gcov. I think it is because of this line from GCovParser.cs. The first and last line number are equal, so there can only be either 0 or 1 covered lines of code. codeElements.Add(new CodeElement(name, CodeElementType.Method, maxiumLineNumber + 1, maxiumLineNumber + 1)); I'm not sure of a great way to determine when a function ends from gcov files. Could update the previous function's last line when encountering the next "function" text or end-of-file. The .gcov file does have the "blocks executed" percentage already calculated and in the file. Could use that value. You know your report generator tool well and maybe you already have a better idea. I put a new regular expression for parsing the gcov function line in GCovParser.cs. Letting you know in case that helps. /// <summary>
/// Regex to analyze if a line contains function coverage data.
/// </summary>
private static Regex functionCoverageRegex = new Regex("function\\s*(?<FunctionName>[^\\s]+)\\s*called\\s*(?<CalledCount>\\d+)\\s*returned\\s*(?<ReturnedPercent>\\d+)%\\s*blocks\\sexecuted\\s*(?<BlocksExecutedPercent>\\d+)%"); |
I'm still working on it. |
I believe it's not ready yet. If you thought it was, you would have published a release. I was interested in your approach, so I took a look, tested it, and gave some feedback. I think it looks great. Thank you for working on this feature. I didn't know about the line coverage and block coverage difference. You are correct. People would log issues saying the coverage does not match. |
If you like you can try my changes again. It now works for all input formats. Instead of the block coverage I'm detecting the first and last line of each method. |
I tried only with gcov through ceedling and your latest changes are working well. I like having a way to quickly navigate to the source code needing additional unit tests. Thank you for making these changes. Maybe it's my eyes, but to me it appears the red part of the coverage percent indicator is slightly offset toward the left when compared to the green part. Do you see that as well? Maybe that is intentional. |
I see that too. |
I see it too. But it disappears when I zoom in. |
I published a new release which includes the new feature: |
@danielpalme Thank you! |
@danielpalme What do you think about coloring the method links to match their coverage percent? I'm referring to the method / property links on the right side of an html page that shows the source code and highlights which lines are covered or not. I think users could more quickly navigate to uncovered or partially covered methods if they are color coded. The method name could be colored and / or the icon next to the function / method name could be color coded.
I don't know which input types support function coverage information. I do know gcov supports covered line % in a function because I use gcov with the ceedling unit tests. We recently added support to call report generator from ceedling.
I experimented with changing a few report generator source files and it appears to work well. These changes set the method name color, not the icon color. Not sure if the way I made the changes goes along with your design, so I sent the .cs source files in a zip file instead of a pull request.
Consider an enable / disable command line option similar to those found here, if you think some people may like this change while others dislike it:
https://github.com/danielpalme/ReportGenerator/wiki/Settings
ColorCodeMethodNames.zip
The text was updated successfully, but these errors were encountered: