docker/swarmkit

View on GitHub

Showing 1,008 of 1,820 total issues

Function ParseAddSecret has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func ParseAddSecret(cmd *cobra.Command, spec *api.ServiceSpec, flagName string) error {
    flags := cmd.Flags()

    if flags.Changed(flagName) {
        secrets, err := flags.GetStringSlice(flagName)
Severity: Minor
Found in swarmd/cmd/swarmctl/service/flagparser/secret.go - About 25 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 containerAdapter.pullImage has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func (c *containerAdapter) pullImage(ctx context.Context) error {
    rc, err := c.client.ImagePull(ctx, c.container.image(), c.container.imagePullOptions())
    if err != nil {
        return err
    }
Severity: Minor
Found in swarmd/dockerexec/adapter.go - About 25 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 controller.Logs has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func (r *controller) Logs(ctx context.Context, publisher exec.LogPublisher, options api.LogSubscriptionOptions) error {
    if err := r.checkClosed(); err != nil {
        return err
    }

Severity: Minor
Found in swarmd/dockerexec/controller.go - About 25 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 Cluster.Size has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func (m *Cluster) Size() (n int) {
    if m == nil {
        return 0
    }
    var l int
Severity: Minor
Found in api/objects.pb.go - About 25 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

Function InterpolateService has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func InterpolateService(origSpec *api.ServiceSpec) *api.ServiceSpec {
    spec := origSpec.Copy()

    container := spec.Task.GetContainer()
    defaultContainer := Service.Task.GetContainer()
Severity: Minor
Found in api/defaults/service.go - About 25 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 VolumeSpec.MarshalToSizedBuffer has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func (m *VolumeSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) {
    i := len(dAtA)
    _ = i
    var l int
    _ = l
Severity: Minor
Found in api/specs.pb.go - About 25 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 roleManager.reconcileRole has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func (rm *roleManager) reconcileRole(ctx context.Context, node *api.Node) {
    if node.Role == node.Spec.DesiredRole {
        // Nothing to do.
        delete(rm.pendingReconciliation, node.ID)
        return
Severity: Minor
Found in manager/role_manager.go - About 25 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 LogBroker.ListenSubscriptions has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func (lb *LogBroker) ListenSubscriptions(request *api.ListenSubscriptionsRequest, stream api.LogBroker_ListenSubscriptionsServer) error {
    remote, err := ca.RemoteNode(stream.Context())
    if err != nil {
        return err
    }
Severity: Minor
Found in manager/logbroker/broker.go - About 25 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

Severity
Category
Status
Source
Language