MicrosoftPremier / VstsExtensions

Documentation and issue tracking for Microsoft Premier Services Visual Studio Team Services Extensions
MIT License
56 stars 14 forks source link

Build Quality warning filter does not match all occurrences #45

Closed AlmeidaAndre closed 4 years ago

AlmeidaAndre commented 4 years ago

I use Build Quality Checks task to check for Doxygen warnings.

The task is configured as follows: image

The doxygen warnings I have are like the following:

Generating docs for compound time...
Generating docs for compound timestamp...
Generating docs for compound control...
Generating docs for compound entry...
C:/.../Src/Mem.c:141: warning: documented empty return type of  malloc
C:/.../Src/Mem.c:155: warning: documented empty return type of  memcpy
C:/.../Src/Mem.c:200: warning: documented empty return type of  memset
C:/.../Src/Mem.c:234: warning: documented empty return type of  memsrt
Generating docs for compound timestamp...
Generating docs for compound control...

For warnings like the above, the Build Quality Checks task gives me the output below:

==============================================================================
Task         : Build Quality Checks
Description  : Breaks a build based on quality metrics like number of warnings or code coverage.
Version      : 6.1.1
Author       : Microsoft Premier Services
Help         : [[Docs]](https://github.com/MicrosoftPremier/VstsExtensions/blob/master/BuildQualityChecks/en-US/overview.md)
==============================================================================
...
##[debug]PSGer.Build.PollInterval=undefined
##[debug]PSGer.Build.MaxWaitTime=undefined
##[debug]getEnabledPolicies
##[debug]checkWarnings=true
##[debug] - warnings
##[debug]checkCoverage=false
##[debug]getCurrentJobOrPhaseName
##[debug]prepareClients
##[debug]runTitle=null
##[debug]waitForPreviousBuildStepsToFinish
##[debug]getPreviousBuildSteps
##[debug]prepareClients
Validating build warnings policy...
##[debug]warningFailOption=fixed
##[debug]warningTaskFilters=/^Build\sdoxygen/i
##[debug]prepareRegexFilters
##[debug]Valid regex filters: /^Build\sdoxygen/i
##[debug]warningFilters=/ warning\: /g
##[debug]prepareRegexFilters
##[debug]Valid regex filters: / warning\: /g
##[debug]showStatistics=true
##[debug]getBuildJobRecords
##[debug]prepareClients
##[debug]Build.BuildId=11162
##[debug]analyzeWarnings
Counting warnings from tasks:
- Build doxygen
##[debug]inclusiveFiltering=false
##[debug]getTimelineLogLines
##[debug]prepareClients
-   Total warnings: 0, Filtered warnings: 2
Total warnings: 0
Filtered warnings: 2

It is counting only half the total number of warnings. I tested the warning filter regex in www.regex101.com, and it matched all occurrences.

I have tried to test others regexin the task, but nothing seens to match all occurrences.

Could you guys help me? Thanks in advance.

woehrl01 commented 4 years ago

Hi @AlmeidaAndre ,

thank you for reporting this. The issue is based on using the /g flag inside your regex. I could verify this in a unit test, that if you omit this and just use / warning\: / as the Warning Filters, it should return all 4 warnings.

Best Lukas

AlmeidaAndre commented 4 years ago

Hi @woehrl01 ,

I tested without /g, and all warnings were returned.

Thank you for your help!

ReneSchumacher commented 4 years ago

@AlmeidaAndre We found the root cause for the issue and made a small change to the task to ensure that regular expressions that use the global flag (/g) also work properly. Thank you again for reporting this and helping us improve the task quality!

Happy building! René