Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked frommibk/dupl

a tool for code clone detection

License

NotificationsYou must be signed in to change notification settings

golangci/dupl

 
 

Repository files navigation

dupl is a tool written in Go for finding code clones. So far it can find clones onlyin the Go source files. The method uses suffix tree for serialized ASTs. It ignores valuesof AST nodes. It just operates with their types (e.g.if a == 13 {} andif x == 100 {} areconsidered the same provided it exceeds the minimal token sequence size).

Due to the used method dupl can report so-called "false positives" on the output. These arethe ones we do not consider clones (whether they are too small, or the values of the matchedtokens are completely different).

Installation

go get -u github.com/golangci/dupl

Usage

Usage of dupl:  dupl [flags] [paths]Paths:  If the given path is a file, dupl will use it regardless of  the file extension. If it is a directory it will recursively  search for *.go files in that directory.  If no path is given dupl will recursively search for *.go  files in the current directory.Flags:  -files        read file names from stdin one at each line  -html        output the results as HTML, including duplicate code fragments  -plumbing        plumbing (easy-to-parse) output for consumption by scripts or tools  -t, -threshold size        minimum token sequence size as a clone (default 15)  -vendor        check files in vendor directory  -v, -verbose        explain what is being doneExamples:  dupl -t 100        Search clones in the current directory of size at least        100 tokens.  dupl $(find app/ -name '*_test.go')        Search for clones in tests in the app directory.  find app/ -name '*_test.go' |dupl -files        The same as above.

Example

The reduced output of this command with the following parameters for theDocker source codelooks likethis.

$ dupl -t 200 -html>docker.html

About

a tool for code clone detection

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go57.1%
  • HTML42.6%
  • Makefile0.3%

[8]ページ先頭

©2009-2025 Movatter.jp