LCOV - code coverage report
Current view: top level - src - match_include_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 explicitly include a relative path
       5                 :             :  *
       6                 :             :  * Compares the path against PCRE2 patterns supplied via --include=
       7                 :             :  * A match overrides any --ignore pattern for the same path
       8                 :             :  *
       9                 :             :  * @param[in] relative_path Relative path to test
      10                 :             :  * @return INCLUDE if matched, DO_NOT_INCLUDE if not,
      11                 :             :  *         FAIL_REGEXP_INCLUDE on PCRE2 error
      12                 :             :  */
      13                 :       18590 : Include match_include_pattern(const char *relative_path)
      14                 :             : {
      15         [ +  + ]:       18590 :         if(config->include_pcre_compiled == NULL)
      16                 :             :         {
      17                 :             :                 // Nothing to include
      18                 :       17970 :                 return(DO_NOT_INCLUDE);
      19                 :             :         }
      20                 :             : 
      21         [ +  + ]:        2030 :         for(int i = 0; config->include_pcre_compiled[i] != NULL; ++i)
      22                 :             :         {
      23                 :        1496 :                 REGEXP result = match_regexp(config->include_pcre_compiled[i],relative_path);
      24                 :             : 
      25         [ +  + ]:        1496 :                 if(MATCH == result)
      26                 :             :                 {
      27                 :             :                         // Include that file
      28                 :          86 :                         return(INCLUDE);
      29                 :             : 
      30         [ -  + ]:        1410 :                 } else if(REGEXP_ERROR == result){
      31                 :             : 
      32                 :           0 :                         return(FAIL_REGEXP_INCLUDE);
      33                 :             : 
      34                 :             :                 }
      35                 :             :         }
      36                 :             : 
      37                 :             :         // No --include pattern matched
      38                 :         534 :         return(DO_NOT_INCLUDE);
      39                 :             : }
        

Generated by: LCOV version 2.0-1