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 : : }
|