couchbaselabs / gocb-example

Example code that demonstrates GoCB usage
Apache License 2.0
0 stars 2 forks source link

issues identified by gometalinter #1

Open mschoch opened 7 years ago

mschoch commented 7 years ago

Some of these are subjective, but if this is being used as our example going forward I'd suggest we try to resolve most of these:

main.go:594::error: unreachable code (vet)
main.go:274::warning: SQL string formatting,MEDIUM,HIGH (gas)
main.go:24:2:warning: const sampleDocId should be sampleDocID (golint)
main.go:38:6:warning: exported type DocProcessorInput should have comment or be unexported (golint)
main.go:43:1:warning: comment on exported type DocProcessor should be of the form "DocProcessor ..." (with optional leading article) (golint)
main.go:46:6:warning: exported type DocProcessorReturnDocs should have comment or be unexported (golint)
main.go:48:6:warning: exported type BucketSpec should have comment or be unexported (golint)
main.go:54:1:warning: comment on exported type ExampleApp should be of the form "ExampleApp ..." (with optional leading article) (golint)
main.go:67:1:warning: comment on exported function NewExample should be of the form "NewExample ..." (golint)
main.go:156:1:warning: exported method ExampleApp.CopyBucketAnonymizeDoc should have comment or be unexported (golint)
main.go:178:10:warning: range var docId should be docID (golint)
main.go:186:4:warning: var newDocId should be newDocID (golint)
main.go:189:5:warning: var anonymizedDocId should be anonymizedDocID (golint)
main.go:215:1:warning: comment on exported method ExampleApp.CopyBucketAddXATTRS should be of the form "CopyBucketAddXATTRS ..." (golint)
main.go:223:10:warning: range var docId should be docID (golint)
main.go:262:1:warning: exported method ExampleApp.CopyBucket should have comment or be unexported (golint)
main.go:270:1:warning: exported function TableScanN1qlQuery should have comment or be unexported (golint)
main.go:281:1:warning: exported method ExampleApp.CopyBucketWithCallback should have comment or be unexported (golint)
main.go:319:11:warning: range var docId should be docID (golint)
main.go:358:1:warning: exported method ExampleApp.GetXattrs should have comment or be unexported (golint)
main.go:358:32:warning: method parameter docId should be docID (golint)
main.go:373:1:warning: exported method ExampleApp.GetSubdocField should have comment or be unexported (golint)
main.go:373:37:warning: method parameter docId should be docID (golint)
main.go:385:1:warning: exported method ExampleApp.SetSubdocField should have comment or be unexported (golint)
main.go:385:37:warning: method parameter docId should be docID (golint)
main.go:399:1:warning: comment on exported method ExampleApp.ForEachDocIdTargetBucket should be of the form "ForEachDocIdTargetBucket ..." (golint)
main.go:400:22:warning: method ForEachDocIdTargetBucket should be ForEachDocIDTargetBucket (golint)
main.go:403:9:warning: if block ends with a return statement, so drop this else and outdent its block (golint)
main.go:408:1:warning: exported method ExampleApp.ForEachDocIdSourceBucket should have comment or be unexported (golint)
main.go:408:22:warning: method ForEachDocIdSourceBucket should be ForEachDocIDSourceBucket (golint)
main.go:411:9:warning: if block ends with a return statement, so drop this else and outdent its block (golint)
main.go:416:1:warning: comment on exported method ExampleApp.ForEachDocIdBucketN1ql should be of the form "ForEachDocIdBucketN1ql ..." (golint)
main.go:417:22:warning: method ForEachDocIdBucketN1ql should be ForEachDocIDBucketN1ql (golint)
main.go:433:3:warning: var rowIdRaw should be rowIDRaw (golint)
main.go:437:3:warning: var rowIdStr should be rowIDStr (golint)
main.go:460:1:warning: exported method ExampleApp.ForEachDocIdBucketViewsConcurrent should have comment or be unexported (golint)
main.go:460:22:warning: method ForEachDocIdBucketViewsConcurrent should be ForEachDocIDBucketViewsConcurrent (golint)
main.go:521:1:warning: comment on exported method ExampleApp.ForEachDocIdBucketViews should be of the form "ForEachDocIdBucketViews ..." (golint)
main.go:523:22:warning: method ForEachDocIdBucketViews should be ForEachDocIDBucketViews (golint)
main.go:564:4:warning: var rowIdRaw should be rowIDRaw (golint)
main.go:568:4:warning: var rowIdStr should be rowIDStr (golint)
main.go:582:4:warning: should replace skip += 1 with skip++ (golint)
main.go:583:4:warning: should replace numResultsProcessed += 1 with numResultsProcessed++ (golint)
main.go:599:1:warning: exported method ExampleApp.AddNameSpaceToTypeFieldViaSubdoc should have comment or be unexported (golint)
main.go:605:10:warning: range var docId should be docID (golint)
main.go:672::warning: declaration of "err" shadows declaration at main.go:655 (vetshadow)
main.go:239:80:warning: unnecessary conversion (unconvert)
main.go:281::warning: cyclomatic complexity 11 of function (*ExampleApp).CopyBucketWithCallback() is high (> 10) (gocyclo)
main.go:207:2:warning: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013) (gosimple)
main.go:254:2:warning: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013) (gosimple)
main.go:263:2:warning: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013) (gosimple)
main.go:391:2:warning: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013) (gosimple)
main.go:553:41:warning: should omit comparison to bool constant, can be simplified to !gotRow (S1002) (gosimple)
main.go:624:2:warning: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013) (gosimple)
main.go:367:13:warning: error return value not checked (res.Content(xattrKey, &xattrVal)) (errcheck)
main.go:379:14:warning: error return value not checked (frag.Content(subdocKey, &retValue)) (errcheck)
main.go:644:11:warning: error return value not checked (e.Connect("couchbase://localhost")) (errcheck)
tleyden commented 7 years ago

Awesome! I'll add a badge to this repo for go-metalinter