{"id":16912512,"url":"https://github.com/boyter/dcd","last_synced_at":"2025-03-17T07:31:00.793Z","repository":{"id":57596223,"uuid":"297887011","full_name":"boyter/dcd","owner":"boyter","description":"Duplicate Code Detector","archived":false,"fork":false,"pushed_at":"2025-02-06T05:33:52.000Z","size":1035,"stargazers_count":58,"open_issues_count":1,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-27T19:35:23.871Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boyter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-23T07:21:10.000Z","updated_at":"2025-02-06T05:33:55.000Z","dependencies_parsed_at":"2022-09-26T20:01:33.140Z","dependency_job_id":"e0685d55-c6cd-48f2-8910-c2976b07595a","html_url":"https://github.com/boyter/dcd","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boyter%2Fdcd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boyter%2Fdcd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boyter%2Fdcd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boyter%2Fdcd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boyter","download_url":"https://codeload.github.com/boyter/dcd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243848111,"owners_count":20357492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T19:10:20.015Z","updated_at":"2025-03-17T07:31:00.785Z","avatar_url":"https://github.com/boyter.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Duplicate Code Detector (dcd)\n-----------------------------\n\nA tool similar to simian http://www.harukizaemon.com/simian/ now found at https://simian.quandarypeak.com/ which is designed to identify duplicate code inside a project.\nIt is however under a free software license.\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/boyter/dcd)](https://goreportcard.com/report/github.com/boyter/dcd)\n[![Dcd Count Badge](https://sloc.xyz/github/boyter/dcd/)](https://github.com/boyter/dcd/)\n\nLicensed under [GNU Affero General Public License 3.0](https://www.gnu.org/licenses/agpl-3.0.html).\n\n### Support\n\nUsing `dcd` commercially? If you want priority support for `dcd` you can purchase a years worth https://boyter.gumroad.com/l/wajuc which entitles you to priority direct email support from the developer.\n\n### Install\n\n#### Go Get\n\nIf you are comfortable using Go and have \u003e= 1.19 installed:\n\n```shell\ngo install github.com/boyter/dcd@latest\n```\n\n#### Manual\n\nBinaries for GNU/Linux and macOS for both i386 and x86_64 and ARM64 machines are available from the [releases](https://github.com/boyter/dcd/releases) page.\n\n### Pitch\n\nWhy use `dcd`?\n\n- It's reasonably fast and works with large projects \n- Works very well across multiple platforms without slowdown (GNU/Linux, macOS)\n\n### Usage\n\nCommand line usage of `dcd` is designed to be as simple as possible.\nFull details can be found in `dcd --help` or `dcd -h`. Note that the below reflects the state of master not a release.\n\n```\n$ dcd -h\ndcd\nVersion 1.1.0\nBen Boyter \u003cben@boyter.org\u003e\n\nUsage:\n  dcd [flags]\n\nFlags:\n  -x, --exclude-pattern strings   file and directory locations matching case sensitive patterns will be ignored [comma separated list: e.g. vendor,_test.go]\n  -f, --fuzz uint8                fuzzy value where higher numbers allow increasingly fuzzy lines to match, values 0-255 where 0 indicates exact match\n  -h, --help                      help for dcd\n  -i, --include-ext strings       limit to file extensions [comma separated list: e.g. go,java,js]\n  -m, --match-length int          min match length (default 6)\n      --max-read-size-bytes int   number of bytes to read into a file with the remaining content ignored (default 10000000)\n      --min-line-length int       number of bytes per average line for file to be considered minified (default 255)\n      --no-gitignore              disables .gitignore file logic\n      --no-ignore                 disables .ignore file logic\n      --process-same-file         \n  -v, --verbose                   verbose output\n      --version                   version for dcd\n\n```\n\nOutput should look something like the below for any project\n\n```\n$ dcd\nFound duplicate lines in processor/cocomo_test.go:\n lines 0-8 match 0-8 in processor/workers_tokei_test.go (length 8)\nFound duplicate lines in processor/cocomo_test.go:\n lines 0-8 match 0-8 in processor/detector_test.go (length 8)\nFound duplicate lines in processor/cocomo_test.go:\n lines 0-6 match 0-6 in processor/helpers_test.go (length 6)\nFound duplicate lines in processor/detector_test.go:\n lines 0-8 match 0-8 in processor/processor_test.go (length 8)\nFound duplicate lines in processor/detector_test.go:\n lines 0-8 match 0-8 in processor/workers_tokei_test.go (length 8)\nFound duplicate lines in processor/detector_test.go:\n lines 0-8 match 0-8 in processor/cocomo_test.go (length 8)\nFound duplicate lines in processor/detector_test.go:\n lines 0-6 match 0-6 in processor/helpers_test.go (length 6)\nFound duplicate lines in processor/detector_test.go:\n lines 0-8 match 2-10 in processor/processor_unix_test.go (length 8)\nFound duplicate lines in processor/filereader.go:\n lines 0-7 match 0-7 in processor/workers.go (length 7)\nFound duplicate lines in processor/filereader.go:\n lines 0-6 match 0-6 in processor/formatters.go (length 6)\n\n\u003e\u003e SNIP \u003c\u003c\n\nFound 98634 duplicate lines in 140 files\n```\n\nNote that you don't have to specify the directory you want to run against. Running `dcd` will assume you want to \nrun against the current directory.\n\n### Ignore Files\n\n`dcd` mostly supports .ignore files inside directories that it scans. This is similar to how ripgrep, ag and tokei work. \n.ignore files are 100% the same as .gitignore files with the same syntax, and as such `dcd` will ignore files and directories\nlisted in them. You can add .ignore files to ignore things like vendored dependency checked in files and such. \nThe idea is allowing you to add a file or folder to git and have ignored in the count.\n\n### Development\n\nIf you want to hack away feel free! PR's are generally accepted.\n\n### Package\n\nThe below produces all the packages for binary releases.\n\n```\nGOOS=darwin GOARCH=amd64 go build -ldflags=\"-s -w\" \u0026\u0026 zip -r9 dcd-1.0.0-x86_64-apple-darwin.zip dcd\nGOOS=darwin GOARCH=arm64 go build -ldflags=\"-s -w\" \u0026\u0026 zip -r9 dcd-1.0.0-arm64-apple-darwin.zip dcd\nGOOS=windows GOARCH=amd64 go build -ldflags=\"-s -w\" \u0026\u0026 zip -r9 dcd-1.0.0-x86_64-pc-windows.zip dcd.exe\nGOOS=windows GOARCH=386 go build -ldflags=\"-s -w\" \u0026\u0026 zip -r9 dcd-1.0.0-i386-pc-windows.zip dcd.exe\nGOOS=linux GOARCH=amd64 go build -ldflags=\"-s -w\" \u0026\u0026 zip -r9 dcd-1.0.0-x86_64-unknown-linux.zip dcd\nGOOS=linux GOARCH=386 go build -ldflags=\"-s -w\" \u0026\u0026 zip -r9 dcd-1.0.0-i386-unknown-linux.zip dcd\nGOOS=linux GOARCH=arm64 go build -ldflags=\"-s -w\" \u0026\u0026 zip -r9 dcd-1.0.0-arm64-unknown-linux.zip dcd\n```\n### Reading\n\nSome of the ideas for detection taken from this paper https://ieeexplore.ieee.org/document/792593\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboyter%2Fdcd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboyter%2Fdcd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboyter%2Fdcd/lists"}