LCOV - code coverage report
Current view: top level - src - match_ignore_pattern.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 90.0 % 10 9
Test Date: 2026-03-31 13:51:38 Functions: 100.0 % 1 1
Branches: 87.5 % 8 7

             Branch data     Line data    Source code
       1                 :             : #include "precizer.h"
       2                 :             : 
       3                 :             : /**
       4                 :             :  * @brief Decide whether to ignore a relative path
       5                 :             :  *
       6                 :             :  * Compares the path against PCRE2 patterns supplied via --ignore=
       7                 :             :  *
       8                 :             :  * @param[in] relative_path Relative path to test
       9                 :             :  * @return IGNORE if matched, DO_NOT_IGNORE if not,
      10                 :             :  *         FAIL_REGEXP_IGNORE on PCRE2 error
      11                 :             :  */
      12                 :       18504 : Ignore match_ignore_pattern(const char *relative_path)
      13                 :             : {
      14         [ +  + ]:       18504 :         if(config->ignore_pcre_compiled == NULL)
      15                 :             :         {
      16                 :             :                 // Nothing to ignore
      17                 :       16720 :                 return(DO_NOT_IGNORE);
      18                 :             :         }
      19                 :             : 
      20         [ +  + ]:        3766 :         for(int i = 0; config->ignore_pcre_compiled[i] != NULL; ++i)
      21                 :             :         {
      22                 :        2358 :                 REGEXP result = match_regexp(config->ignore_pcre_compiled[i],relative_path);
      23                 :             : 
      24         [ +  + ]:        2358 :                 if(MATCH == result)
      25                 :             :                 {
      26                 :             :                         // Ignore that file
      27                 :         376 :                         return(IGNORE);
      28                 :             : 
      29         [ -  + ]:        1982 :                 } else if(REGEXP_ERROR == result){
      30                 :             : 
      31                 :           0 :                         return(FAIL_REGEXP_IGNORE);
      32                 :             : 
      33                 :             :                 }
      34                 :             :         }
      35                 :             : 
      36                 :             :         // No --ignore pattern matched
      37                 :        1408 :         return(DO_NOT_IGNORE);
      38                 :             : }
        

Generated by: LCOV version 2.0-1