Showing 1,468 of 1,914 total issues
Method Controller.handleEpTableEvent
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *Controller) handleEpTableEvent(ev events.Event) {
var (
nid string
eid string
value []byte
Function skipAgent
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func skipAgent(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
Function skipNetworkdb
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func skipNetworkdb(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
Function skipOverlay
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func skipOverlay(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
Method networkRouter.getNetwork
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (n *networkRouter) getNetwork(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
Function skipPlugin
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func skipPlugin(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
Function skipEntry
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func skipEntry(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
Method tarexporter.Load
has 22 return statements (exceeds 4 allowed). Open
Open
func (l *tarexporter) Load(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) (outErr error) {
ctx, span := tracing.StartSpan(ctx, "tarexport.Load")
defer span.End()
defer func() {
span.SetStatus(outErr)
Method NetworkDB.bulkSyncNode
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (nDB *NetworkDB) bulkSyncNode(networks []string, node string, unsolicited bool) error {
var msgs [][]byte
var unsolMsg string
if unsolicited {
Method windowsParser.validateMountConfigReg
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (p *windowsParser) validateMountConfigReg(mnt *mount.Mount, additionalValidators ...mountValidator) error {
if len(mnt.Target) == 0 {
return &errMountConfig{mnt, errMissingField("Target")}
}
for _, v := range additionalValidators {
Method executor.Describe
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
info, err := e.backend.SystemInfo(ctx)
if err != nil {
return nil, err
}
Method Daemon.killWithSignal
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (daemon *Daemon) killWithSignal(container *containerpkg.Container, stopSignal syscall.Signal) error {
log.G(context.TODO()).WithFields(log.Fields{
"signal": int(stopSignal),
"container": container.ID,
}).Debugf("sending signal %[1]d (%[1]s) to container", stopSignal)
Function volumeSpecToGRPC
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func volumeSpecToGRPC(spec volumetypes.ClusterVolumeSpec) *swarmapi.VolumeSpec {
swarmSpec := &swarmapi.VolumeSpec{
Group: spec.Group,
}
Method tarSum.Read
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (ts *tarSum) Read(buf []byte) (int, error) {
if ts.finished {
return ts.bufWriter.Read(buf)
}
if len(ts.bufData) < len(buf) {
Method Daemon.fillRootlessVersion
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (daemon *Daemon) fillRootlessVersion(ctx context.Context, v *types.Version) error {
if !rootless.RunningWithRootlessKit() {
return nil
}
rlc, err := getRootlessKitClient()
Function withFetchProgress
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func withFetchProgress(cs content.Store, out progress.Output, ref reference.Named) images.HandlerFunc {
return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
switch desc.MediaType {
case ocispec.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest:
tn := reference.TagNameOnly(ref)
Method Resolver.serveDNS
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (r *Resolver) serveDNS(w dns.ResponseWriter, query *dns.Msg) {
var (
resp *dns.Msg
err error
)
Function newProxy
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func newProxy(config ProxyConfig) (p Proxy, err error) {
ipv := ip4
if config.HostIP.To4() == nil {
ipv = ip6
}
Method Daemon.getInspectData
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (daemon *Daemon) getInspectData(daemonCfg *config.Config, container *container.Container) (*containertypes.ContainerJSONBase, error) {
// make a copy to play with
hostConfig := *container.HostConfig
children := daemon.children(container)
Method puller.pullManifestList
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
Open
func (p *puller) pullManifestList(ctx context.Context, ref reference.Named, mfstList *manifestlist.DeserializedManifestList, pp *ocispec.Platform) (id digest.Digest, manifestListDigest digest.Digest, err error) {
manifestListDigest, err = schema2ManifestDigest(ref, mfstList)
if err != nil {
return "", "", err
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"