Preparing report...

Report for github.com/hashicorp/raft

A+    Excellent!    Found 16 issues across 57 files

Tweet

gofmt98%

Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command


go_vet100%

go vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.

No problems detected. Good job!


gocyclo78%

Gocyclo calculates cyclomatic complexities of functions in Go source code. The cyclomatic complexity of a function is calculated according to the following rules: 1 is the base complexity of a function +1 for each 'if', 'for', 'case', '&&' or '||' Go Report Card warns on functions with cyclomatic complexity > 15.

    • raft/raft.go
    • Line 562: warning: cyclomatic complexity 45 of function (*Raft).leaderLoop() is high (> 15) (gocyclo)
    • Line 1286: warning: cyclomatic complexity 22 of function (*Raft).appendEntries() is high (> 15) (gocyclo)
    • Line 151: warning: cyclomatic complexity 18 of function (*Raft).runFollower() is high (> 15) (gocyclo)
    • Line 1450: warning: cyclomatic complexity 18 of function (*Raft).requestVote() is high (> 15) (gocyclo)
    • Line 251: warning: cyclomatic complexity 16 of function (*Raft).runCandidate() is high (> 15) (gocyclo)
    • raft/fsm.go
    • Line 69: warning: cyclomatic complexity 25 of function (*Raft).runFSM() is high (> 15) (gocyclo)
    • raft/api.go
    • Line 285: warning: cyclomatic complexity 22 of function RecoverCluster() is high (> 15) (gocyclo)
    • Line 458: warning: cyclomatic complexity 17 of function NewRaft() is high (> 15) (gocyclo)
    • raft/raft_test.go
    • Line 122: warning: cyclomatic complexity 16 of function TestRaft_RecoverCluster() is high (> 15) (gocyclo)

golint92%

Golint is a linter for Go source code.

    • raft/bench/bench.go
    • Line 13: warning: exported function FirstIndex should have comment or be unexported (golint)
    • Line 30: warning: exported function LastIndex should have comment or be unexported (golint)
    • Line 47: warning: exported function GetLog should have comment or be unexported (golint)
    • Line 66: warning: exported function StoreLog should have comment or be unexported (golint)
    • Line 76: warning: exported function StoreLogs should have comment or be unexported (golint)
    • Line 95: warning: exported function DeleteRange should have comment or be unexported (golint)
    • Line 121: warning: exported function Set should have comment or be unexported (golint)
    • Line 130: warning: exported function Get should have comment or be unexported (golint)
    • Line 147: warning: exported function SetUint64 should have comment or be unexported (golint)
    • Line 156: warning: exported function GetUint64 should have comment or be unexported (golint)
    • raft/api.go
    • Line 18: warning: comment on exported const SuggestedMaxDataSize should be of the form "SuggestedMaxDataSize ..." (golint)
    • raft/log_cache.go
    • Line 33: warning: exported method LogCache.GetLog should have comment or be unexported (golint)
    • Line 49: warning: exported method LogCache.StoreLog should have comment or be unexported (golint)
    • Line 53: warning: exported method LogCache.StoreLogs should have comment or be unexported (golint)
    • Line 67: warning: exported method LogCache.FirstIndex should have comment or be unexported (golint)
    • Line 71: warning: exported method LogCache.LastIndex should have comment or be unexported (golint)
    • Line 75: warning: exported method LogCache.DeleteRange should have comment or be unexported (golint)
    • raft/testing.go
    • Line 44: warning: comment on exported type MockFSMConfigStore should be of the form "MockFSMConfigStore ..." (with optional leading article) (golint)
    • Line 49: warning: comment on exported type WrappingFSM should be of the form "WrappingFSM ..." (with optional leading article) (golint)
    • Line 67: warning: comment on exported type MockSnapshot should be of the form "MockSnapshot ..." (with optional leading article) (golint)
    • Line 75: warning: comment on exported method MockFSM.Apply should be of the form "Apply ..." (golint)
    • Line 83: warning: comment on exported method MockFSM.Snapshot should be of the form "Snapshot ..." (golint)
    • Line 90: warning: comment on exported method MockFSM.Restore should be of the form "Restore ..." (golint)
    • Line 102: warning: comment on exported method MockFSM.Logs should be of the form "Logs ..." (golint)
    • Line 109: warning: comment on exported method MockFSMConfigStore.StoreConfiguration should be of the form "StoreConfiguration ..." (golint)
    • Line 117: warning: comment on exported method MockSnapshot.Persist should be of the form "Persist ..." (golint)
    • Line 129: warning: comment on exported method MockSnapshot.Release should be of the form "Release ..." (golint)
    • Line 655: warning: comment on exported type MakeClusterOpts should be of the form "MakeClusterOpts ..." (with optional leading article) (golint)
    • Line 769: warning: comment on exported function MakeCluster should be of the form "MakeCluster ..." (golint)
    • Line 778: warning: comment on exported function MakeClusterNoBootstrap should be of the form "MakeClusterNoBootstrap ..." (golint)
    • Line 786: warning: comment on exported function MakeClusterCustom should be of the form "MakeClusterCustom ..." (golint)
    • Line 791: warning: comment on exported function FileSnapTest should be of the form "FileSnapTest ..." (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign98%

IneffAssign detects ineffectual assignments in Go code.


misspell96%

Misspell Finds commonly misspelled English words

    • raft/api.go
    • Line 55: warning: "commited" is a misspelling of "committed" (misspell)
    • Line 765: warning: "preceeding" is a misspelling of "preceding" (misspell)
    • Line 1024: warning: "occured" is a misspelling of "occurred" (misspell)