Report for github.com/cni-genie/CNI-Genie

A+    Excellent!    Found 32 issues across 58 files

Tweet

gofmt100%

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

No problems detected. Good job!


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!


gocyclo96%

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.


golint46%

Golint is a linter for Go source code.

    • CNI-Genie/plugins/macvlan.go
    • Line 34: warning: exported function GetMacvlanConfig should have comment or be unexported (golint)
    • Line 63: warning: exported function GetDefaultNic should have comment or be unexported (golint)
    • CNI-Genie/controllers/network-admission-controller/network-validator.go
    • Line 34: warning: comment on exported type PluginSubnetUsageData should be of the form "PluginSubnetUsageData ..." (with optional leading article) (golint)
    • Line 41: warning: exported const ERR_NO_PLUGIN_MENTIONED_IN_LOGICAL_NETWORK should have comment (or a comment on this block) or be unexported (golint)
    • Line 51: warning: exported var PluginSubnetUsageDataList should have comment or be unexported (golint)
    • Line 63: warning: exported function GetKubeClient should have comment or be unexported (golint)
    • CNI-Genie/client/client.go
    • Line 16: warning: exported type ClientInterface should have comment or be unexported (golint)
    • Line 22: warning: exported type KubeClient should have comment or be unexported (golint)
    • Line 26: warning: exported method KubeClient.GetPod should have comment or be unexported (golint)
    • Line 35: warning: exported method KubeClient.PatchPod should have comment or be unexported (golint)
    • Line 44: warning: exported method KubeClient.GetRaw should have comment or be unexported (golint)
    • Line 53: warning: comment on exported function BuildKubeClientFromConfig should be of the form "BuildKubeClientFromConfig ..." (golint)
    • CNI-Genie/interfaces/cni.go
    • Line 5: warning: exported type CNI should have comment or be unexported (golint)
    • Line 15: warning: exported type Cni should have comment or be unexported (golint)
    • Line 17: warning: exported method Cni.ConfListFromFile should have comment or be unexported (golint)
    • Line 17: warning: receiver name should not be an underscore, omit the name if it is unused (golint)
    • Line 21: warning: exported method Cni.ConfListFromBytes should have comment or be unexported (golint)
    • Line 21: warning: receiver name should not be an underscore, omit the name if it is unused (golint)
    • Line 25: warning: exported method Cni.ConfFromFile should have comment or be unexported (golint)
    • Line 25: warning: receiver name should not be an underscore, omit the name if it is unused (golint)
    • Line 29: warning: exported method Cni.ConfFromBytes should have comment or be unexported (golint)
    • Line 29: warning: receiver name should not be an underscore, omit the name if it is unused (golint)
    • Line 33: warning: exported method Cni.ConfListFromConf should have comment or be unexported (golint)
    • Line 33: warning: receiver name should not be an underscore, omit the name if it is unused (golint)
    • Line 37: warning: exported method Cni.ConfFiles should have comment or be unexported (golint)
    • Line 37: warning: receiver name should not be an underscore, omit the name if it is unused (golint)
    • Line 41: warning: exported method Cni.ConfListFromConfBytes should have comment or be unexported (golint)
    • Line 41: warning: receiver name should not be an underscore, omit the name if it is unused (golint)
    • CNI-Genie/interfaces/invoke.go
    • Line 9: warning: exported type InvokeExec should have comment or be unexported (golint)
    • Line 14: warning: exported type Invoke should have comment or be unexported (golint)
    • Line 18: warning: exported method Invoke.InvokeExecAdd should have comment or be unexported (golint)
    • Line 24: warning: exported method Invoke.InvokeExecDel should have comment or be unexported (golint)
    • CNI-Genie/utils/types.go
    • Line 29: warning: comment on exported const IfNameDelimiter should be of the form "IfNameDelimiter ..." (golint)
    • Line 33: warning: exported type ContainerInfoGenie should have comment or be unexported (golint)
    • Line 38: warning: exported type ContainerStatsGenie should have comment or be unexported (golint)
    • Line 44: warning: exported type InterfaceBandwidthUsage should have comment or be unexported (golint)
    • Line 50: warning: exported type AllInterfaces should have comment or be unexported (golint)
    • Line 74: warning: comment on exported type KubernetesConfig should be of the form "KubernetesConfig ..." (with optional leading article) (golint)
    • Line 102: warning: comment on exported type MultiIPPreferences should be of the form "MultiIPPreferences ..." (with optional leading article) (golint)
    • Line 110: warning: exported type IPAddressPreferences should have comment or be unexported (golint)
    • Line 156: warning: exported type ValidateResult should have comment or be unexported (golint)
    • Line 163: warning: don't use underscores in Go names; struct field Refer_nic should be ReferNic (golint)
    • CNI-Genie/interfaces/fake.go
    • Line 15: warning: exported type FakeIo should have comment or be unexported (golint)
    • Line 19: warning: exported type FakeInvoke should have comment or be unexported (golint)
    • Line 24: warning: exported type FakeCni should have comment or be unexported (golint)
    • Line 66: warning: exported method FakeIo.ReadFile should have comment or be unexported (golint)
    • Line 72: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • Line 77: warning: exported method FakeIo.ReadDir should have comment or be unexported (golint)
    • Line 84: warning: exported method FakeIo.CreateFile should have comment or be unexported (golint)
    • Line 93: warning: exported function SetIp should have comment or be unexported (golint)
    • Line 134: warning: exported method FakeInvoke.InvokeExecAdd should have comment or be unexported (golint)
    • Line 138: warning: exported method FakeInvoke.InvokeExecDel should have comment or be unexported (golint)
    • Line 147: warning: exported method FakeCni.ConfListFromFile should have comment or be unexported (golint)
    • Line 151: warning: exported method FakeCni.ConfListFromBytes should have comment or be unexported (golint)
    • Line 155: warning: exported method FakeCni.ConfFromFile should have comment or be unexported (golint)
    • Line 159: warning: exported method FakeCni.ConfFromBytes should have comment or be unexported (golint)
    • Line 163: warning: exported method FakeCni.ConfListFromConf should have comment or be unexported (golint)
    • Line 167: warning: exported method FakeCni.ConfListFromConfBytes should have comment or be unexported (golint)
    • Line 171: warning: exported method FakeCni.ConfFiles should have comment or be unexported (golint)
    • CNI-Genie/interfaces/files.go
    • Line 8: warning: exported type RW should have comment or be unexported (golint)
    • Line 14: warning: exported type IO should have comment or be unexported (golint)
    • Line 16: warning: exported method IO.ReadFile should have comment or be unexported (golint)
    • Line 16: warning: receiver name should not be an underscore, omit the name if it is unused (golint)
    • Line 20: warning: exported method IO.ReadDir should have comment or be unexported (golint)
    • Line 20: warning: receiver name should not be an underscore, omit the name if it is unused (golint)
    • Line 24: warning: exported method IO.CreateFile should have comment or be unexported (golint)
    • Line 24: warning: receiver name should not be an underscore, omit the name if it is unused (golint)
    • CNI-Genie/controllers/network-policy-controller/iptables/iptables.go
    • Line 1: warning: package comment should be of the form "Package iptable ..." (golint)
    • Line 27: warning: exported const GenieBaseNPCChain should have comment (or a comment on this block) or be unexported (golint)
    • Line 37: warning: exported type IpTables should have comment or be unexported (golint)
    • Line 41: warning: exported function ExitStatus should have comment or be unexported (golint)
    • Line 45: warning: exported function CreateIptableChainName should have comment or be unexported (golint)
    • Line 50: warning: exported function CreatePolicyChainName should have comment or be unexported (golint)
    • Line 91: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 280: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • CNI-Genie/controllers/network-policy-controller/networkpolicycontroller.go
    • Line 40: warning: should not use dot imports (golint)
    • Line 48: warning: exported const ControllerAgentName should have comment (or a comment on this block) or be unexported (golint)
    • Line 52: warning: exported type NetworkPolicyController should have comment or be unexported (golint)
    • Line 68: warning: exported type NetworkPolicy should have comment or be unexported (golint)
    • Line 73: warning: exported type AsSelector should have comment or be unexported (golint)
    • Line 78: warning: exported type AsPeer should have comment or be unexported (golint)
    • Line 84: warning: exported type NetworkPolicyInfo should have comment or be unexported (golint)
    • Line 235: warning: exported method NetworkPolicyController.Run should have comment or be unexported (golint)
    • Line 568: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • CNI-Genie/controllers/network-policy-controller/ipset/ipset.go
    • Line 1: warning: package comment should be of the form "Package ipset ..." (golint)
    • Line 23: warning: exported type IpSet should have comment or be unexported (golint)
    • Line 40: warning: exported function New should have comment or be unexported (golint)
    • Line 48: warning: exported method IpSet.Create should have comment or be unexported (golint)
    • Line 60: warning: exported method IpSet.Add should have comment or be unexported (golint)
    • Line 66: warning: exported method IpSet.AddExist should have comment or be unexported (golint)
    • Line 72: warning: exported method IpSet.Del should have comment or be unexported (golint)
    • Line 78: warning: exported method IpSet.List should have comment or be unexported (golint)
    • Line 88: warning: exported method IpSet.ListSets should have comment or be unexported (golint)
    • Line 97: warning: exported method IpSet.ListMatchedSets should have comment or be unexported (golint)
    • Line 113: warning: exported method IpSet.Exists should have comment or be unexported (golint)
    • Line 124: warning: exported method IpSet.Flush should have comment or be unexported (golint)
    • Line 130: warning: exported method IpSet.Destroy should have comment or be unexported (golint)
    • CNI-Genie/interfaces/config.go
    • Line 14: warning: exported const DefaultNetDir should have comment (or a comment on this block) or be unexported (golint)
    • Line 19: warning: exported type CNIConfig should have comment or be unexported (golint)
    • Line 27: warning: exported method CNIConfig.GetInstalledPlugins should have comment or be unexported (golint)
    • Line 41: warning: comment on exported method CNIConfig.CreateConfFile should be of the form "CreateConfFile ..." (golint)
    • Line 53: warning: exported method CNIConfig.GetCNIConfList should have comment or be unexported (golint)
    • Line 57: warning: exported method CNIConfig.LoadNetConfList should have comment or be unexported (golint)
    • Line 61: warning: exported method CNIConfig.LoadConfFiles should have comment or be unexported (golint)
    • Line 70: warning: exported method CNIConfig.GetConfFiles should have comment or be unexported (golint)
    • Line 74: warning: exported method CNIConfig.ParseCNIConfFromFile should have comment or be unexported (golint)
    • Line 104: warning: exported method CNIConfig.ParseCNIConfFromBytes should have comment or be unexported (golint)
    • Line 113: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • CNI-Genie/genie/genie-controller.go
    • Line 50: warning: exported const DefaultNetDir should have comment (or a comment on this block) or be unexported (golint)
    • Line 62: warning: don't use underscores in Go names; const err_nopod_novar should be errNopodNovar (golint)
    • Line 63: warning: comment on exported const DefaultCNIVersion should be of the form "DefaultCNIVersion ..." (golint)
    • Line 67: warning: exported type SetStatus should have comment or be unexported (golint)
    • Line 75: warning: exported type GenieController should have comment or be unexported (golint)
    • Line 95: warning: exported function NewGenieController should have comment or be unexported (golint)
    • CNI-Genie/networkcrd/networkattachmentdefinition.go
    • Line 69: warning: exported function GetNetworkInfo should have comment or be unexported (golint)
    • Line 112: warning: exported function GetConfigFromFile should have comment or be unexported (golint)
    • Line 116: warning: exported function GetConfigFromSpec should have comment or be unexported (golint)
    • Line 148: warning: exported function GetNetworkCRDObject should have comment or be unexported (golint)
    • CNI-Genie/genie/genie-cadvisor-client.go
    • Line 30: warning: should not use dot imports (golint)
    • Line 45: warning: exported type Cadvisor should have comment or be unexported (golint)
    • Line 50: warning: comment on exported type CadClient should be of the form "CadClient ..." (with optional leading article) (golint)
    • Line 59: warning: comment on exported method GenieController.GetDockerContainers should be of the form "GetDockerContainers ..." (golint)
    • Line 176: warning: comment on exported method GenieController.GetCNSOrderByNetworkBandwith should be of the form "GetCNSOrderByNetworkBandwith ..." (golint)
    • Line 207: warning: exported method CadClient.Get should have comment or be unexported (golint)
    • Line 211: warning: exported method CadClient.Post should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign96%

IneffAssign detects ineffectual assignments in Go code.

    • CNI-Genie/e2e/cni-genie_k8s_test.go
    • Line 784: warning: ineffectual assignment to err (ineffassign)
    • Line 861: warning: ineffectual assignment to err (ineffassign)
    • Line 902: warning: ineffectual assignment to err (ineffassign)
    • Line 923: warning: ineffectual assignment to err (ineffassign)
    • Line 1002: warning: ineffectual assignment to err (ineffassign)
    • Line 1008: warning: ineffectual assignment to err (ineffassign)
    • Line 1010: warning: ineffectual assignment to err (ineffassign)

misspell96%

Misspell Finds commonly misspelled English words