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
Regression in 6.2.2 and 6.2.1 of Build Quality Checks? #64
Comments
Hi @andrebriggs, the YAML configuration is invalid. The coverageFailOption can either be build or fixed but not Previous Value (see https://github.com/MicrosoftPremier/VstsExtensions/blob/master/BuildQualityChecks/en-US/WarningsPolicy.md#failoption). I would have thought that the build system would throw an error when you specify an invalid entry in YAML as this clearly violates the allowed options in the task.json. Apparently, it doesn't. We'll add error handling for this in the next update. To fix the issue, please set the coverageFailOption to build. |
@ReneSchumacher thanks. Changing the I have a log from a build here :
The code coverage referred to above is 59.8963 and from build 1144 (see coverage report here: https://dev.azure.com/abrig/spk/_build/results?buildId=1144&view=codecoverage-tab) I'm assuming the 59.8963 value refers to the circled value in the screenshot below (Not rounded up if so)? If so why that particular value? The overall branch coverage isn't close to that value at all. Moreover the 2nd code coverage value in the build log of 60.1059 doesn't see to correspond with anything in the build from the log (build 1146 here) I'm probably misunderstanding the instructions but the line My configuration is here:
|
Another thing @ReneSchumacher. After looking at the documentation again I decided to remove
After that I get the same value (59.8963) for coverage in the comparison. I expect the same value since no code was changed but still confused about where the value is coming
|
@ReneSchumacher Looks like the 59.8963 value is the <coverage lines-valid="2368" lines-covered="1701" line-rate="0.7182999999999999" branches-valid="1157" branches-covered="693" branch-rate="0.599" timestamp="1578966048486" complexity="0" version="0.1"> This must be an issue with the code coverage HTML generation not matching what is in the |
Hi @andrebriggs, as you already figured out the coverage value is taken from the cobertura coverage file. Or more precisely: our task just queries coverage for a build using the Azure DevOps REST API and Azure DevOps simply takes the coverage data from the coverage result file (in your case cobertura). Unfortunately, the testing tools team decided to use the OSS tool ReportGenerator (see https://github.com/danielpalme/ReportGenerator) to render the code coverage report in the Azure DevOps UI. This tool, however, parses the coverage file and does not use the summary information. While parsing, they get different coverage values. We already talked to the ReportGenerator team and they are convinced that their strategy is correct. The testing tools team apparently isn't very keen on fixing this issue, and I am trying to figure out how to fix it without having to run code coverage analysis myself. Since cobertura is (afaik) just the format, I guess the issue is in the Istanbul coverage generator. Are you using Istanbul to generate code coverage? The buildPlatform, buildConfiguration, and explicitFilter parameters don't make any difference in your case, because you are generating coverage data that is not assigned with a specific configuration or platform. Imho, only our VSTest runner adds that information to the coverage data so that you can distinguish between coverage for multiple configurations in a multi-config build. René |
Hi @andrebriggs, I just published v6.2.3 of the task that fixes the exception you mentioned. The task will still fail with a proper error message when the YAML properties are invalid. I'm still trying to figure out why the values differ between ReportGenerator and Cobertura/Istanbul. However, since we cannot fix this behavior in our task, I'm closing the issue but keep digging. René |
@andrebriggs: I did a couple evaluations of several Cobertura reports and the corresponding ReportGenerator output and finally found the reason for the different coverage values. Apparently Istanbul does not properly report switch statements in the Cobertura report. Thus, ReportGenerator does not notice branches that are created through switch statement. I have reported this in the ReportGenerator project (see danielpalme/ReportGenerator#289) and will also create an issue in the Istanbul project in hopes that someone will fix it. |
The problem is, that the report generated by Instanbul is not consistent. If ReportGenerator would use the summary value (0.8889), then the branches in the code (6 of 6) wouldn't match that result. |
Hey @danielpalme, I'm not blaming anyone and I have explained the issue here and in the issue I created in your repo. It is still unfortunate that we decided to use ReportGenerator in this case, since our build summary showed the (correct) value from the coverage summary before. Since we switched to ReportGenerator, the coverage value shown in the code coverage section is wrong due to the incorrect data in the Cobertura file. As I said, I'm going to open an issue with the Istanbul team so we can hopefully fix this. Istanbul apparently has the correct values, since the summary values are all correct. However, someone forgot to put switches and jumps into the report details. The good news is, though, that the data reported by our task is correct :D So don't worry, ReportGenerator is still a great tool and it wasn't my intention to do you or the tool any harm. René |
Just for reference: istanbuljs/istanbuljs#517 |
Thanks for the follow up @ReneSchumacher. I might have to look into the Istanbul code. One more question. The log below has the Build Quality Checks passing when the current code coverage is 59.8963 and the previous (baseline) code coverage is 60.1059. I would have expected the task to fail? Perhaps the configuration is incorrect again?
Current config
|
Yes, it's a config issue again. The default delta type is absolute (see https://github.com/MicrosoftPremier/VstsExtensions/blob/master/BuildQualityChecks/en-US/CodeCoveragePolicy.md#coverageDeltaType), i.e., the policy is comparing the absolute number of blocks. Your current build has 693 covered blocks, the previous one had 681 covered blocks. Add |
Hey everyone, I submitted a fix for the coverage values issue: istanbuljs/istanbuljs#518 |
Possibly related to #57 FYI, I'm using GitHub to host the code repositories.
My config
Version 6.1.2
Version 6.2.1
Version 6.2.2
The text was updated successfully, but these errors were encountered: