Open steve21124 opened 8 years ago
Yes, it'd be possible to some extent, but nothing is currently implemented. I'll keep this open as a rule request. Here's my comment from the duplicate issue you just opened up on SourceKitten (jpsim/SourceKitten#216):
You can find duplicate code just by doing regular text parsing. You don't need SourceKitten for that.
If you want to build a system that detects similar patterns, with heuristics accounting small variations in structure and naming, you could certainly do that using text parsing augmented by SourceKitten's
Structure
construct.But SourceKitten doesn't ship a CLI command or API that will "show all duplicated code".
@steve21124 probably better to use something like https://github.com/kucherenko/jscpd
Doesn't look like jscpd supports Swift.
Swift language support added to jscpd jscpd@0.6.4
Sweet, thanks @kucherenko for the quick turnaround on that!
since swiftlint use sourcekit, do you think it is possible to detect duplicate code through result from sourcekit?