Skip to content

static-code-analysis: cpd: increase minimum number of tokens to match

Anjan Chanda requested to merge cpd-tokens-match into master

Need to increase minimum number of tokens to be matched for duplicate detection. Value 100 seems to be not suitable and it generates false warnings as following -

-snip-

Found a 9 line (103 tokens) duplication in the following files: Starting at line 319 of /home/anjan/IOPSYS/smarthub3/build_dir/target-arm_xscale_musl_eabi/map-controller-5.1.1/src/utils/utils.c Starting at line 148 of /home/anjan/IOPSYS/smarthub3/build_dir/target-arm_xscale_musl_eabi/map-controller-5.1.1/src/utils/utils.h

int list_join_uniq(void *priv, struct list_head *a, struct list_head *b, struct list_head *out, int (*match)(void *priv, struct list_head *a, struct list_head *b), struct list_head *(*create_jentry)(void *priv, struct list_head *a, struct list_head *b), void (*free_jentry)(void *priv, struct list_head *), void (*free_entry_a)(struct list_head *), void (*free_entry_b)(struct list_head *)) -snip-

'cpd' matched the lines containing a function prototype with that of its definition in c file.

Merge request reports