6.2.6.4. RustCloneDetection

Find clones in Rust files

Detects cloned sections in Rust files using structural comparison. Computes clones of type-1 (exact), type-2 (parameterized), and type-3 (near-miss) clones. All .rs files within the analyzed Rust project are processed, filtering options can be applied.

Possible Messages

This rule has no predefined messages.

Options

advanced

Advanced options for gxl or statistics output.
 

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

Output found clones as GXL file.
 

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.
 

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 = 50

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).
 

report_trait_impl_clones

report_trait_impl_clones : bool = False

If false, do not report clones between different impls of the same trait.
 

type3_similarity

type3_similarity : int = 80

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