Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule to detect duplicate code #682

Open
steve21124 opened this issue Jun 7, 2016 · 5 comments
Open

Add rule to detect duplicate code #682

steve21124 opened this issue Jun 7, 2016 · 5 comments

Comments

@steve21124
Copy link

since swiftlint use sourcekit, do you think it is possible to detect duplicate code through result from sourcekit?

@jpsim
Copy link
Collaborator

jpsim commented Jun 7, 2016

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

@jpsim jpsim changed the title Duplicate code detection? Add rule to detect duplicate code Jun 7, 2016
@masters3d
Copy link
Contributor

@steve21124 probably better to use something like https://github.com/kucherenko/jscpd

@jpsim
Copy link
Collaborator

jpsim commented Aug 22, 2016

Doesn't look like jscpd supports Swift.

@kucherenko
Copy link

Swift language support added to jscpd
jscpd@0.6.4

@jpsim
Copy link
Collaborator

jpsim commented Aug 23, 2016

Sweet, thanks @kucherenko for the quick turnaround on that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants