etcd-io/etcd
Distributed reliable key-value store for the most critical data of a distributed system
The score is jscpd's own --health model: markup, data and text left out, tests kept. The numbers below are the trending scan's.
Most complex files
- api/etcdserverpb/rpc.pb.go1219 cx
- api/etcdserverpb/gw/rpc.pb.gw.go636 cx
- server/etcdserver/server.go407 cx
- api/etcdserverpb/rpc_grpc.pb.go356 cx
- tests/framework/e2e/cluster.go302 cx
- tests/framework/integration/cluster.go284 cx
- tests/integration/v3_grpc_test.go277 cx
- server/etcdserver/v3_server.go275 cx
- tests/integration/cache_test.go255 cx
- tests/integration/clientv3/watch/watch_test.go249 cx
Dead code
Not measured: no JavaScript, TypeScript, Python or compiler-checked Rust files.
The code number leaves out tests, fixtures, docs, examples, data files, styles, translations and vendored code, and 18 generated files: api/authpb/auth.pb.go, api/etcdserverpb/etcdserver.pb.go, api/etcdserverpb/gw/rpc.pb.gw.go, api/etcdserverpb/raft_internal.pb.go, api/etcdserverpb/rpc_grpc.pb.go, api/etcdserverpb/rpc.pb.go, api/membershippb/membership.pb.go, api/mvccpb/kv.pb.go, api/versionpb/version.pb.go, server/etcdserver/api/snap/snappb/snap.pb.go, server/etcdserver/api/v3election/v3electionpb/gw/v3election.pb.gw.go, server/etcdserver/api/v3election/v3electionpb/v3election_grpc.pb.go, server/etcdserver/api/v3election/v3electionpb/v3election.pb.go, server/etcdserver/api/v3lock/v3lockpb/gw/v3lock.pb.gw.go, server/etcdserver/api/v3lock/v3lockpb/v3lock_grpc.pb.go, server/etcdserver/api/v3lock/v3lockpb/v3lock.pb.go, server/lease/leasepb/lease.pb.go, server/storage/wal/walpb/record.pb.go.
Largest clones in the code
- 11 lines in 4 placesgo74 tokensetcdctl/ctlv3/command/printer_table.go:29–39etcdctl/ctlv3/command/printer_table.go:40–50etcdctl/ctlv3/command/printer_table.go:51–61etcdutl/etcdutl/printer_table.go:29–39
29 hdr, rows := makeMemberListTable(r) 30 cfgBuilder := tablewriter.NewConfigBuilder().WithRowAlignment(tw.AlignRight) 31 table := tablewriter.NewTable(os.Stdout, tablewriter.WithConfig(cfgBuilder.Build())) 32 table.Header(hdr) 33 for _, row := range rows { 34 table.Append(row) 35 } 36 table.Render() 37} 38First 10 of 11 lines.
- 27 lines in 2 placesgo204 tokens
134} 135 136// Fill the canvas with the plots and legends. 137canvases := plot.Align(plots, t, dc) 138for i := 0; i < rows; i++ { 139 for j := 0; j < cols; j++ { 140 // Continue if there is no plot in the current cell (incomplete data). 141 if plots[i][j] == nil { 142 continue 143 }First 10 of 27 lines.
- 18 lines in 2 placesgo138 tokens
63 PS> etcdctl completion powershell > etcdctl.ps1 64 # and source this file from your PowerShell profile. 65`, 66 DisableFlagsInUseLine: true, 67 ValidArgs: []string{"bash", "zsh", "fish", "powershell"}, 68 Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), 69 Run: func(cmd *cobra.Command, args []string) { 70 switch args[0] { 71 case "bash": 72 cmd.Root().GenBashCompletion(os.Stdout)First 10 of 18 lines.
7 more
- 9 lines in 3 placesgo68 tokens
- 6 lines in 3 placesgo66 tokens
- 23 lines in 2 placesgo127 tokens
- 13 lines in 3 placesgo62 tokens
- 12 lines in 3 placesgo62 tokens
- 17 lines in 2 placesgo122 tokens
- 6 lines in 3 placesgo58 tokens
Largest clones over all files, tests and data included
- 10 lines in 108 placesgogenerated51 tokensapi/authpb/auth.pb.go:95–104api/authpb/auth.pb.go:143–152api/authpb/auth.pb.go:211–220api/authpb/auth.pb.go:271–280api/etcdserverpb/etcdserver.pb.go:47–56and 103 more
95 mi := &file_auth_proto_msgTypes[0] 96 if x != nil { 97 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 98 if ms.LoadMessageInfo() == nil { 99 ms.StoreMessageInfo(mi) 100 } 101 return ms 102 } 103 return mi.MessageOf(x) 104} - 9 lines in 44 placesgo92 tokensapi/etcdserverpb/gw/rpc.pb.gw.go:42–50api/etcdserverpb/gw/rpc.pb.gw.go:69–77api/etcdserverpb/gw/rpc.pb.gw.go:96–104api/etcdserverpb/gw/rpc.pb.gw.go:123–131api/etcdserverpb/gw/rpc.pb.gw.go:150–158and 39 more
42 metadata runtime.ServerMetadata 43) 44if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { 45 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 46} 47if req.Body != nil { 48 _, _ = io.Copy(io.Discard, req.Body) 49} 50msg, err := client.Range(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))69 metadata runtime.ServerMetadata 70) 71if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { 72 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 73} 74if req.Body != nil { 75 _, _ = io.Copy(io.Discard, req.Body) 76} 77msg, err := client.Put(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - 7 lines in 47 placesgo85 tokensapi/etcdserverpb/gw/rpc.pb.gw.go:1261–1267api/etcdserverpb/gw/rpc.pb.gw.go:1281–1287api/etcdserverpb/gw/rpc.pb.gw.go:1301–1307api/etcdserverpb/gw/rpc.pb.gw.go:1321–1327api/etcdserverpb/gw/rpc.pb.gw.go:1341–1347and 42 more
1261mux.Handle(http.MethodPost, pattern_KV_Range_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 1262 ctx, cancel := context.WithCancel(req.Context()) 1263 defer cancel() 1264 var stream runtime.ServerTransportStream 1265 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 1266 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 1267 annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/etcdserverpb.KV/Range", runtime.WithHTTPPathPattern("/v3/kv/range"))1281mux.Handle(http.MethodPost, pattern_KV_Put_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 1282 ctx, cancel := context.WithCancel(req.Context()) 1283 defer cancel() 1284 var stream runtime.ServerTransportStream 1285 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 1286 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 1287 annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/etcdserverpb.KV/Put", runtime.WithHTTPPathPattern("/v3/kv/put")) - 7 lines in 47 placesgo82 tokens
- 8 lines in 15 placesgotests95 tokens
By format, code only
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| go | 503 | 87,139 | 112 | 1,151 | 1.32% |
| bash | 36 | 4,211 | 0 | 0 | 0% |
By format, all files
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| go | 1,003 | 218,833 | 1,691 | 16,947 | 7.74% |
| markdown | 60 | 13,063 | 151 | 1,603 | 12.27% |
| go-module | 14 | 927 | 22 | 186 | 20.06% |
| json | 20 | 5,204 | 14 | 374 | 7.19% |
| yaml | 28 | 1,733 | 8 | 75 | 4.33% |
| makefile | 5 | 664 | 8 | 54 | 8.13% |
| markup | 9 | 1,401 | 6 | 127 | 9.06% |
| bash | 51 | 5,279 | 4 | 50 | 0.95% |
| text | 12 | 345 | 4 | 40 | 11.59% |
| txt | 3 | 583 | 1 | 9 | 1.54% |
Trending appearances
| Day | Rank | Stars | Files | Lines | Clones | All files | Code | Health | Commit |
|---|---|---|---|---|---|---|---|---|---|
| Nov 7, 2026 | #9 | 52,634 (+128) | 1,229 | 250,463 | 1,910 | 7.77% | 1.26% | D 52.7 | d622ec5 |
Want this for your own project? Install jscpd and run jscpd ., or measure it the way the baselines were measured.