Branch data Line data Source code
1 : : #include "precizer.h"
2 : :
3 : : /**
4 : : *
5 : : * Decide whether or not to ignore the relative
6 : : * path to the file by comparing it with PCRE2 regular
7 : : * expressions passed as arguments with --ignore=
8 : : *
9 : : */
10 : 16000 : Ignore match_ignore_pattern(
11 : : const char *relative_path,
12 : : bool *ignore_showed_once)
13 : : {
14 [ + + ]: 16000 : if(config->ignore == NULL)
15 : : {
16 : : // Nothing to ignore
17 : 14256 : return(DO_NOT_IGNORE);
18 : : }
19 : :
20 [ + + ]: 3696 : for(int i = 0; config->ignore[i] != NULL; ++i)
21 : : {
22 : 2296 : REGEXP result = regexp_match(config->ignore[i],relative_path,ignore_showed_once);
23 : :
24 [ + + ]: 2296 : if(MATCH == result)
25 : : {
26 : : // Ignore that file
27 : 344 : return(IGNORE);
28 : :
29 [ - + ]: 1952 : } else if(REGEXP_ERROR == result){
30 : :
31 : 0 : return(FAIL_REGEXP_IGNORE);
32 : :
33 : : }
34 : : }
35 : :
36 : : // Don't ignore the file
37 : 1400 : return(DO_NOT_IGNORE);
38 : : }
|