idea
Code duplication is generally lowering maintainability of code by requiring more changes for similar needs (although sometimes repetition is incidental and shouldn't be factorize), and increases the chance of bugs through deviating logic that should be similar.
Code duplication therefore is a code smell, detecting code duplication is then useful to block or resolve problematic code. There are mainly two ways of doing so:
- Text-based detection, which looks at pure copy-paste.
- Token-based detection, which looks at a tokenized version of the code[1].
Detecting duplicate code is also code "Clone detection"