KBEC-00141 - Ignoring matches in postp

Article ID:360032831172
1 minute readKnowledge base
On this page

Summary

Changing the postp warning matcher so it outputs as an error but ignores warnings around certain files. For example, when compiling third-party code that contains warnings that I have chosen not to resolve, I want any warnings outside of those files to be labeled as a failure to the build.

Solution

  1. use --check none to not use any matchers
    Here is an example ignoring all matches:

     postp --check none --loadProperty /myProject/newPostpMatchers
  2. Use --ignore.
    ignore regular expression pattern: any line in the log file matching this pattern will be skipped without matching it against the matchers. There may be multiple --ignore options.
    Here is an example ignoring a warning message:

     postp --ignore "warning C4244" --loadProperty /myProject/newPostpMatchers
  3. Use --dontCheck
    Here is an example ignoring a warning message using dontCheck:

     postp --dontCheck coreDump --loadProperty /myProject/newPostpMatchers
  4. Create you own matcher that does nothing:

    1. Create your own matcher.

    2. Set the pattern to the regex you want to ignore.

    3. Define the action as empty.

    4. Use your matcher in combination with our matcher, making sure that yours is used before ours ("unshift" instead of "push" will do the trick).

       my @newMatchers = (
          {
             id => "IgnoredWarnings",
             pattern => q{warning C4244},
             action => ""
           },
       );
       unshift @::gMatchers, @newMatchers;