Preparing report...

Report for github.com/osrg/gobgp

(v0.0.0-20211201041502-6248c576b118)

A    Great!    Found 53 issues across 95 files

Tweet

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!


gofmt75%

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


gocyclo60%

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.

    • pkg/packet/bgp/validate.go
    • Line 84: warning: cyclomatic complexity 42 of function ValidateAttribute() is high (> 15) (gocyclo)
    • Line 12: warning: cyclomatic complexity 19 of function ValidateUpdateMsg() is high (> 15) (gocyclo)
    • pkg/server/grpc_server.go
    • Line 1068: warning: cyclomatic complexity 28 of function toStatementApi() is high (> 15) (gocyclo)
    • Line 641: warning: cyclomatic complexity 21 of function newNeighborFromAPIStruct() is high (> 15) (gocyclo)
    • Line 309: warning: cyclomatic complexity 19 of function api2Path() is high (> 15) (gocyclo)
    • internal/pkg/apiutil/attribute.go
    • Line 1542: warning: cyclomatic complexity 78 of function unmarshalAttribute() is high (> 15) (gocyclo)
    • Line 699: warning: cyclomatic complexity 50 of function UnmarshalNLRI() is high (> 15) (gocyclo)
    • Line 516: warning: cyclomatic complexity 28 of function MarshalNLRI() is high (> 15) (gocyclo)
    • Line 1447: warning: cyclomatic complexity 25 of function MarshalPathAttributes() is high (> 15) (gocyclo)
    • Line 1074: warning: cyclomatic complexity 24 of function unmarshalExComm() is high (> 15) (gocyclo)
    • Line 957: warning: cyclomatic complexity 22 of function NewExtendedCommunitiesAttributeFromNative() is high (> 15) (gocyclo)
    • Line 31: warning: cyclomatic complexity 20 of function UnmarshalAttribute() is high (> 15) (gocyclo)
    • Line 385: warning: cyclomatic complexity 19 of function UnmarshalFlowSpecRules() is high (> 15) (gocyclo)
    • cmd/gobgp/policy.go
    • Line 635: warning: cyclomatic complexity 57 of function modCondition() is high (> 15) (gocyclo)
    • Line 835: warning: cyclomatic complexity 35 of function modAction() is high (> 15) (gocyclo)
    • Line 169: warning: cyclomatic complexity 22 of function showDefinedSet() is high (> 15) (gocyclo)
    • Line 432: warning: cyclomatic complexity 21 of function printStatement() is high (> 15) (gocyclo)
    • Line 55: warning: cyclomatic complexity 21 of function prettyString() is high (> 15) (gocyclo)
    • Line 112: warning: cyclomatic complexity 18 of function formatDefinedSet() is high (> 15) (gocyclo)
    • Line 1002: warning: cyclomatic complexity 16 of function newPolicyCmd() is high (> 15) (gocyclo)
    • cmd/gobgp/global.go
    • Line 1171: warning: cyclomatic complexity 46 of function parsePath() is high (> 15) (gocyclo)
    • Line 504: warning: cyclomatic complexity 25 of function parseEvpnMacAdvArgs() is high (> 15) (gocyclo)
    • Line 1627: warning: cyclomatic complexity 18 of function newGlobalCmd() is high (> 15) (gocyclo)
    • Line 369: warning: cyclomatic complexity 16 of function parseFlowSpecArgs() is high (> 15) (gocyclo)
    • Line 769: warning: cyclomatic complexity 16 of function parseEvpnIPPrefixArgs() is high (> 15) (gocyclo)
    • internal/pkg/zebra/zapi_test.go
    • Line 211: warning: cyclomatic complexity 41 of function Test_IPRouteBody_IPv4() is high (> 15) (gocyclo)
    • Line 505: warning: cyclomatic complexity 41 of function Test_IPRouteBody_IPv6() is high (> 15) (gocyclo)
    • pkg/packet/bgp/bgp.go
    • Line 10276: warning: cyclomatic complexity 33 of function ParseExtendedCommunity() is high (> 15) (gocyclo)
    • Line 2317: warning: cyclomatic complexity 32 of function ParseEthernetSegmentIdentifier() is high (> 15) (gocyclo)
    • Line 4684: warning: cyclomatic complexity 29 of function CompareFlowSpecNLRI() is high (> 15) (gocyclo)
    • Line 8115: warning: cyclomatic complexity 29 of function (*PathAttributeLs).DecodeFromBytes() is high (> 15) (gocyclo)
    • Line 3600: warning: cyclomatic complexity 27 of function flowSpecPrefixParser() is high (> 15) (gocyclo)
    • Line 8031: warning: cyclomatic complexity 26 of function (*PathAttributeLs).Extract() is high (> 15) (gocyclo)
    • Line 12871: warning: cyclomatic complexity 24 of function GetPathAttribute() is high (> 15) (gocyclo)
    • Line 12934: warning: cyclomatic complexity 24 of function (*BGPUpdate).DecodeFromBytes() is high (> 15) (gocyclo)
    • Line 8367: warning: cyclomatic complexity 23 of function NewPrefixFromRouteFamily() is high (> 15) (gocyclo)
    • Line 4494: warning: cyclomatic complexity 23 of function (*FlowSpecNLRI).decodeFromBytes() is high (> 15) (gocyclo)
    • Line 13359: warning: cyclomatic complexity 21 of function getErrorHandlingFromPathAttribute() is high (> 15) (gocyclo)
    • Line 9734: warning: cyclomatic complexity 16 of function (*PathAttributeMpReachNLRI).DecodeFromBytes() is high (> 15) (gocyclo)
    • cmd/gobgp/vrf.go
    • Line 122: warning: cyclomatic complexity 19 of function modVrf() is high (> 15) (gocyclo)
    • Line 193: warning: cyclomatic complexity 17 of function newVrfCmd() is high (> 15) (gocyclo)
    • pkg/server/fsm.go
    • Line 1202: warning: cyclomatic complexity 42 of function (*fsmHandler).opensent() is high (> 15) (gocyclo)
    • Line 929: warning: cyclomatic complexity 29 of function (*fsmHandler).recvMessageWithError() is high (> 15) (gocyclo)
    • Line 592: warning: cyclomatic complexity 23 of function (*fsmHandler).active() is high (> 15) (gocyclo)
    • Line 1583: warning: cyclomatic complexity 23 of function (*fsmHandler).sendMessageloop() is high (> 15) (gocyclo)
    • Line 1751: warning: cyclomatic complexity 22 of function (*fsmHandler).established() is high (> 15) (gocyclo)
    • Line 1473: warning: cyclomatic complexity 20 of function (*fsmHandler).openconfirm() is high (> 15) (gocyclo)
    • Line 1145: warning: cyclomatic complexity 18 of function open2Cap() is high (> 15) (gocyclo)
    • Line 78: warning: cyclomatic complexity 16 of function (fsmStateReason).String() is high (> 15) (gocyclo)
    • pkg/server/zclient.go
    • Line 364: warning: cyclomatic complexity 30 of function (*zebraClient).loop() is high (> 15) (gocyclo)
    • Line 466: warning: cyclomatic complexity 17 of function newZebraClient() is high (> 15) (gocyclo)
    • internal/pkg/config/default.go
    • Line 61: warning: cyclomatic complexity 59 of function setDefaultNeighborConfigValuesWithViper() is high (> 15) (gocyclo)
    • Line 343: warning: cyclomatic complexity 42 of function setDefaultConfigValuesWithViper() is high (> 15) (gocyclo)
    • internal/pkg/zebra/zapi.go
    • Line 2540: warning: cyclomatic complexity 40 of function (*IPRouteBody).decodeFromBytes() is high (> 15) (gocyclo)
    • Line 2047: warning: cyclomatic complexity 36 of function (Nexthop).encode() is high (> 15) (gocyclo)
    • Line 2145: warning: cyclomatic complexity 35 of function (*Nexthop).decode() is high (> 15) (gocyclo)
    • Line 2371: warning: cyclomatic complexity 29 of function (*IPRouteBody).serialize() is high (> 15) (gocyclo)
    • Line 1091: warning: cyclomatic complexity 23 of function (Flag).String() is high (> 15) (gocyclo)
    • Line 1249: warning: cyclomatic complexity 21 of function NewClient() is high (> 15) (gocyclo)
    • Line 2998: warning: cyclomatic complexity 21 of function (*NexthopUpdateBody).decodeFromBytes() is high (> 15) (gocyclo)
    • Line 1009: warning: cyclomatic complexity 20 of function (MessageFlag).string() is high (> 15) (gocyclo)
    • Line 3283: warning: cyclomatic complexity 16 of function parseMessage() is high (> 15) (gocyclo)
    • pkg/server/rpki.go
    • Line 199: warning: cyclomatic complexity 18 of function (*roaManager).handleRTRMsg() is high (> 15) (gocyclo)
    • pkg/server/server.go
    • Line 1338: warning: cyclomatic complexity 64 of function (*BgpServer).handleFSMMessage() is high (> 15) (gocyclo)
    • Line 4285: warning: cyclomatic complexity 28 of function (*BgpServer).watch() is high (> 15) (gocyclo)
    • Line 485: warning: cyclomatic complexity 28 of function filterpath() is high (> 15) (gocyclo)
    • Line 1121: warning: cyclomatic complexity 28 of function (*BgpServer).propagateUpdate() is high (> 15) (gocyclo)
    • Line 1250: warning: cyclomatic complexity 25 of function (*BgpServer).propagateUpdateToNeighbors() is high (> 15) (gocyclo)
    • Line 595: warning: cyclomatic complexity 24 of function (*BgpServer).prePolicyFilterpath() is high (> 15) (gocyclo)
    • Line 2900: warning: cyclomatic complexity 22 of function (*BgpServer).addNeighbor() is high (> 15) (gocyclo)
    • Line 3893: warning: cyclomatic complexity 21 of function (*BgpServer).MonitorTable() is high (> 15) (gocyclo)
    • Line 2538: warning: cyclomatic complexity 19 of function (*BgpServer).ListPath() is high (> 15) (gocyclo)
    • Line 1962: warning: cyclomatic complexity 18 of function (*BgpServer).fixupApiPath() is high (> 15) (gocyclo)
    • Line 3388: warning: cyclomatic complexity 17 of function (*BgpServer).ListDefinedSet() is high (> 15) (gocyclo)
    • Line 2066: warning: cyclomatic complexity 17 of function (*BgpServer).DeletePath() is high (> 15) (gocyclo)
    • Line 3151: warning: cyclomatic complexity 16 of function (*BgpServer).updateNeighbor() is high (> 15) (gocyclo)
    • internal/pkg/config/bgp_configs.go
    • Line 4980: warning: cyclomatic complexity 41 of function (*Bgp).Equal() is high (> 15) (gocyclo)
    • Line 6062: warning: cyclomatic complexity 23 of function (*BgpDefinedSets).Equal() is high (> 15) (gocyclo)
    • Line 4121: warning: cyclomatic complexity 22 of function (*AfiSafi).Equal() is high (> 15) (gocyclo)
    • Line 1909: warning: cyclomatic complexity 22 of function (*PeerGroup).Equal() is high (> 15) (gocyclo)
    • Line 3284: warning: cyclomatic complexity 22 of function (*Neighbor).Equal() is high (> 15) (gocyclo)
    • Line 5630: warning: cyclomatic complexity 20 of function (*BgpConditions).Equal() is high (> 15) (gocyclo)
    • Line 6314: warning: cyclomatic complexity 19 of function (*DefinedSets).Equal() is high (> 15) (gocyclo)
    • Line 3173: warning: cyclomatic complexity 16 of function (*NeighborConfig).Equal() is high (> 15) (gocyclo)
    • cmd/gobgp/neighbor.go
    • Line 232: warning: cyclomatic complexity 66 of function showNeighbor() is high (> 15) (gocyclo)
    • Line 792: warning: cyclomatic complexity 46 of function showNeighborRib() is high (> 15) (gocyclo)
    • Line 1175: warning: cyclomatic complexity 39 of function modNeighbor() is high (> 15) (gocyclo)
    • Line 115: warning: cyclomatic complexity 28 of function showNeighbors() is high (> 15) (gocyclo)
    • Line 1343: warning: cyclomatic complexity 24 of function newNeighborCmd() is high (> 15) (gocyclo)
    • internal/pkg/table/policy.go
    • Line 2778: warning: cyclomatic complexity 34 of function (*Statement).mod() is high (> 15) (gocyclo)
    • Line 3325: warning: cyclomatic complexity 28 of function (*RoutingPolicy).reload() is high (> 15) (gocyclo)
    • Line 3936: warning: cyclomatic complexity 28 of function toStatementApi() is high (> 15) (gocyclo)
    • Line 2694: warning: cyclomatic complexity 25 of function (*Statement).ToConfig() is high (> 15) (gocyclo)
    • Line 1588: warning: cyclomatic complexity 18 of function (*AsPathCondition).Evaluate() is high (> 15) (gocyclo)
    • Line 3242: warning: cyclomatic complexity 17 of function (*RoutingPolicy).validateCondition() is high (> 15) (gocyclo)

ineffassign96%

IneffAssign detects ineffectual assignments in Go code.


license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


misspell96%

Misspell Finds commonly misspelled English words