Clone Detection Configuration¶
Configuration options for Sourcery's Clone Detection feature, specified in the
.sourcery.yaml
file (parent reference)
Fields Overview¶
All fields are optional.
Field | Type | Description |
---|---|---|
min_lines | integer | The minimum number of lines for a piece of code to be considered a clone. |
min_duplicates | integer | The minimum number of duplicates of a piece of code required for it to be considered clone. |
identical_clones_only | boolean | Whether or not exact duplicates are required for a piece of code to be considered a clone. |
Default¶
github:
clone_detection:
min_lines: 3
min_duplicates: 2
identical_clones_only: false
Complete Example¶
github:
clone_detection:
min_lines: 5
identical_clones_only: true
Fields¶
min_lines
¶
integer
The minimum number of lines for a piece of code to be considered a clone.
Default
clone_detection:
min_lines: 3
Example
clone_detection:
min_lines: 5
min_duplicates
¶
integer
The minimum number of duplicates of a piece of code for it to be considered a clone.
Default
clone_detection:
min_duplicates: 2
Example
clone_detection:
min_duplicates: 3
identical_clones_only
¶
boolean
If true
, clones are only detected if they are exactly identical, i.e. contain
the same variable names and constants. If false
(default), clones are more
flexibly detected on the basis of the code's structure only.
Default
clone_detection:
identical_clones_only: false
Example
clone_detection:
identical_clones_only: true