6.2.6.2. C++CloneDetection

Find clones in C and C++ files

Possible Messages

This rule has no predefined messages.

Options

advanced

Options that are normally not required
 

advanced.bucket_cutoff : int = 2000

Ignore buckets larger than the cutoff size.
 

advanced.exclude_classes

Type: set[bauhaus.ir.PIR_Class_Name]

Default: {'Aggregate_Literal', 'Attributed_Definition', 'Enumerator_Definition', 'Field_Definition', 'Global_Variable_Definition', 'Include_Interface', 'Preprocessor', 'Routine_Declaration', 'Type_Declaration', 'Type_Definition', 'Variable_Declaration'}

Physical IR classes that are to be excluded from the hash buckets for later subtree comparison, even if e.g. a parent class has been included for subtree comparison.
 

advanced.file_contents_cutoff : int = 10

Ignore file that are present in more versions than the cutoff size.
 

advanced.gxl_file : bauhaus.analysis.config.LayerRelativePath | None = None

Output found clones as GXL file.
 

advanced.include_classes : set[bauhaus.ir.PIR_Class_Name] = {'Physical_IR_Root'}

Physical IR classes that are to be included in the hash buckets for later subtree comparison.
 

advanced.pre_min_lines : int = 2

Minimum length in lines during hashing phase.
 

advanced.pre_min_weight : int = 2

Minimum weight in nodes during hashing phase.
 

advanced.stats_file : bauhaus.analysis.config.LayerRelativePath | None = None

Output statistics of found clones as CSV file.
 

exclude_predicate

exclude_predicate : typing.Callable[[_irclones.Clone_Pair], bool] | None = None

Clone pairs for which this predicate returns true will not be reported.
 

max_density

max_density : int = 2147483647

Maximum density (weight/lines) of clone pairs to report in percent.
 

min_density

min_density : int = 0

Minimum density (weight/lines) of clone pairs to report in percent.
 

min_lines

min_lines : int = 30

Minimum length in lines of clone pairs to report.
 

min_weight

min_weight : int = 30

Minimum weight in nodes of clone pairs to report.
 

no_sequences

no_sequences : bool = False

Do not report cloned sequences.
 

pre_excludes

pre_excludes : set[bauhaus.analysis.config.GlobPattern] = set()

Set of globbing patterns of directories/filenames to exclude in early hashing phase. No clone pair with either left or right side matching those patterns is ever reported (e.g. */MemMap.h).
 

type3_similarity

type3_similarity : int = 80

Minimum similarity of type-3 clones to report in percent.