dotcloud/docker

View on GitHub
daemon/events.go

Summary

Maintainability
A
3 hrs
Test Coverage

Method Daemon.logServiceEvent has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
Open

func (daemon *Daemon) logServiceEvent(action swarmapi.WatchActionKind, service *swarmapi.Service, oldService *swarmapi.Service) {
    attributes := map[string]string{
        "name": service.Spec.Annotations.Name,
    }
    eventTime := eventTimestamp(service.Meta, action)
Severity: Minor
Found in daemon/events.go - About 1 hr to fix

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"

Further reading

Method Daemon.logNodeEvent has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
Open

func (daemon *Daemon) logNodeEvent(action swarmapi.WatchActionKind, node *swarmapi.Node, oldNode *swarmapi.Node) {
    name := node.Spec.Annotations.Name
    if name == "" && node.Description != nil {
        name = node.Description.Hostname
    }
Severity: Minor
Found in daemon/events.go - About 55 mins to fix

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"

Further reading

Method Daemon.logClusterEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

func (daemon *Daemon) logClusterEvent(action swarmapi.WatchActionKind, id string, eventType events.Type, eventTime time.Time, attributes map[string]string) {
Severity: Minor
Found in daemon/events.go - About 35 mins to fix

    There are no issues that match your filters.

    Category
    Status