docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

Similar blocks of code found in 10 locations. Consider refactoring.
Open

    case *StoreAction_Config:
        switch sa.Action {
        case StoreActionKindCreate:
            return EventCreateConfig{Config: v.Config}, nil
        case StoreActionKindUpdate:
Severity: Major
Found in api/objects.pb.go and 9 other locations - About 45 mins to fix
api/objects.pb.go on lines 5733..5745
api/objects.pb.go on lines 5746..5758
api/objects.pb.go on lines 5759..5771
api/objects.pb.go on lines 5772..5784
api/objects.pb.go on lines 5785..5797
api/objects.pb.go on lines 5798..5810
api/objects.pb.go on lines 5824..5836
api/objects.pb.go on lines 5837..5849
api/objects.pb.go on lines 5850..5862

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func (s *Server) isRunningLocked() (context.Context, error) {
    s.mu.Lock()
    if !s.isRunning() {
        s.mu.Unlock()
        return nil, status.Errorf(codes.Aborted, "CA signer is stopped")
Severity: Minor
Found in ca/server.go and 1 other location - About 45 mins to fix
manager/dispatcher/dispatcher.go on lines 410..419

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        n1 = &api.Network{
            ID: "testID1",
            Spec: api.NetworkSpec{
                Annotations: api.Annotations{
                    Name: "test1",
Severity: Major
Found in manager/allocator/allocator_test_suite.go and 2 other locations - About 45 mins to fix
manager/allocator/allocator_test_suite.go on lines 633..650
manager/allocator/allocator_test_suite.go on lines 880..897

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

    case *StoreAction_Service:
        switch sa.Action {
        case StoreActionKindCreate:
            return EventCreateService{Service: v.Service}, nil
        case StoreActionKindUpdate:
Severity: Major
Found in api/objects.pb.go and 9 other locations - About 45 mins to fix
api/objects.pb.go on lines 5733..5745
api/objects.pb.go on lines 5759..5771
api/objects.pb.go on lines 5772..5784
api/objects.pb.go on lines 5785..5797
api/objects.pb.go on lines 5798..5810
api/objects.pb.go on lines 5811..5823
api/objects.pb.go on lines 5824..5836
api/objects.pb.go on lines 5837..5849
api/objects.pb.go on lines 5850..5862

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

    case *StoreAction_Secret:
        switch sa.Action {
        case StoreActionKindCreate:
            return EventCreateSecret{Secret: v.Secret}, nil
        case StoreActionKindUpdate:
Severity: Major
Found in api/objects.pb.go and 9 other locations - About 45 mins to fix
api/objects.pb.go on lines 5733..5745
api/objects.pb.go on lines 5746..5758
api/objects.pb.go on lines 5759..5771
api/objects.pb.go on lines 5772..5784
api/objects.pb.go on lines 5785..5797
api/objects.pb.go on lines 5811..5823
api/objects.pb.go on lines 5824..5836
api/objects.pb.go on lines 5837..5849
api/objects.pb.go on lines 5850..5862

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

    case *StoreAction_Resource:
        switch sa.Action {
        case StoreActionKindCreate:
            return EventCreateResource{Resource: v.Resource}, nil
        case StoreActionKindUpdate:
Severity: Major
Found in api/objects.pb.go and 9 other locations - About 45 mins to fix
api/objects.pb.go on lines 5733..5745
api/objects.pb.go on lines 5746..5758
api/objects.pb.go on lines 5759..5771
api/objects.pb.go on lines 5772..5784
api/objects.pb.go on lines 5785..5797
api/objects.pb.go on lines 5798..5810
api/objects.pb.go on lines 5811..5823
api/objects.pb.go on lines 5837..5849
api/objects.pb.go on lines 5850..5862

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

    case *StoreAction_Extension:
        switch sa.Action {
        case StoreActionKindCreate:
            return EventCreateExtension{Extension: v.Extension}, nil
        case StoreActionKindUpdate:
Severity: Major
Found in api/objects.pb.go and 9 other locations - About 45 mins to fix
api/objects.pb.go on lines 5733..5745
api/objects.pb.go on lines 5746..5758
api/objects.pb.go on lines 5759..5771
api/objects.pb.go on lines 5772..5784
api/objects.pb.go on lines 5785..5797
api/objects.pb.go on lines 5798..5810
api/objects.pb.go on lines 5811..5823
api/objects.pb.go on lines 5824..5836
api/objects.pb.go on lines 5850..5862

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

    case *StoreAction_Task:
        switch sa.Action {
        case StoreActionKindCreate:
            return EventCreateTask{Task: v.Task}, nil
        case StoreActionKindUpdate:
Severity: Major
Found in api/objects.pb.go and 9 other locations - About 45 mins to fix
api/objects.pb.go on lines 5733..5745
api/objects.pb.go on lines 5746..5758
api/objects.pb.go on lines 5772..5784
api/objects.pb.go on lines 5785..5797
api/objects.pb.go on lines 5798..5810
api/objects.pb.go on lines 5811..5823
api/objects.pb.go on lines 5824..5836
api/objects.pb.go on lines 5837..5849
api/objects.pb.go on lines 5850..5862

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

    case *StoreAction_Volume:
        switch sa.Action {
        case StoreActionKindCreate:
            return EventCreateVolume{Volume: v.Volume}, nil
        case StoreActionKindUpdate:
Severity: Major
Found in api/objects.pb.go and 9 other locations - About 45 mins to fix
api/objects.pb.go on lines 5733..5745
api/objects.pb.go on lines 5746..5758
api/objects.pb.go on lines 5759..5771
api/objects.pb.go on lines 5772..5784
api/objects.pb.go on lines 5785..5797
api/objects.pb.go on lines 5798..5810
api/objects.pb.go on lines 5811..5823
api/objects.pb.go on lines 5824..5836
api/objects.pb.go on lines 5837..5849

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

    case *StoreAction_Node:
        switch sa.Action {
        case StoreActionKindCreate:
            return EventCreateNode{Node: v.Node}, nil
        case StoreActionKindUpdate:
Severity: Major
Found in api/objects.pb.go and 9 other locations - About 45 mins to fix
api/objects.pb.go on lines 5746..5758
api/objects.pb.go on lines 5759..5771
api/objects.pb.go on lines 5772..5784
api/objects.pb.go on lines 5785..5797
api/objects.pb.go on lines 5798..5810
api/objects.pb.go on lines 5811..5823
api/objects.pb.go on lines 5824..5836
api/objects.pb.go on lines 5837..5849
api/objects.pb.go on lines 5850..5862

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        in := &api.Network{
            ID: "overlay1",
            Spec: api.NetworkSpec{
                Annotations: api.Annotations{
                    Name: "net1",
Severity: Major
Found in manager/allocator/allocator_test_suite.go and 2 other locations - About 45 mins to fix
manager/allocator/allocator_test_suite.go on lines 633..650
manager/allocator/allocator_test_suite.go on lines 1049..1066

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        n1 := &api.Network{
            ID: "testID1",
            Spec: api.NetworkSpec{
                Annotations: api.Annotations{
                    Name: "test1",
Severity: Major
Found in manager/allocator/allocator_test_suite.go and 2 other locations - About 45 mins to fix
manager/allocator/allocator_test_suite.go on lines 880..897
manager/allocator/allocator_test_suite.go on lines 1049..1066

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

    case *StoreAction_Network:
        switch sa.Action {
        case StoreActionKindCreate:
            return EventCreateNetwork{Network: v.Network}, nil
        case StoreActionKindUpdate:
Severity: Major
Found in api/objects.pb.go and 9 other locations - About 45 mins to fix
api/objects.pb.go on lines 5733..5745
api/objects.pb.go on lines 5746..5758
api/objects.pb.go on lines 5759..5771
api/objects.pb.go on lines 5785..5797
api/objects.pb.go on lines 5798..5810
api/objects.pb.go on lines 5811..5823
api/objects.pb.go on lines 5824..5836
api/objects.pb.go on lines 5837..5849
api/objects.pb.go on lines 5850..5862

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func (d *Dispatcher) isRunningLocked() (context.Context, error) {
    d.mu.Lock()
    if !d.isRunning() {
        d.mu.Unlock()
        return nil, status.Errorf(codes.Aborted, "dispatcher is stopped")
Severity: Minor
Found in manager/dispatcher/dispatcher.go and 1 other location - About 45 mins to fix
ca/server.go on lines 591..600

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid deeply nested control flow statements.
Open

                            if err != nil {
                                return err
                            }
Severity: Major
Found in swarmd/cmd/swarmctl/service/flagparser/tmpfs.go - About 45 mins to fix

    Function decryptRaftData has 7 return statements (exceeds 4 allowed).
    Open

    func decryptRaftData(swarmdir, outdir, unlockKey string) error {
        krw, err := getKRW(swarmdir, unlockKey)
        if err != nil {
            return err
        }
    Severity: Major
    Found in swarmd/cmd/swarm-rafttool/common.go - About 45 mins to fix

      Method StubAPIClient.ContainerCreate has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func (sa *StubAPIClient) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networking *network.NetworkingConfig, platform *v1.Platform, containerName string) (container.CreateResponse, error) {
      Severity: Minor
      Found in swarmd/dockerexec/docker_client_stub.go - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    switch suffix {
                                    case 'g':
                                        multiplier = 1 << 30
                                    case 'm':
                                        multiplier = 1 << 20
        Severity: Major
        Found in swarmd/cmd/swarmctl/service/flagparser/tmpfs.go - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if container := actype.Task.Spec.GetContainer(); container != nil {
                                          container.Env = []string{"ENVVARS REDACTED"}
                                          if container.PullOptions != nil {
                                              container.PullOptions.RegistryAuth = "REDACTED"
                                          }
          Severity: Major
          Found in swarmd/cmd/swarm-rafttool/dump.go - About 45 mins to fix

            Function parseTmpfs has 7 return statements (exceeds 4 allowed).
            Open

            func parseTmpfs(flags *pflag.FlagSet, spec *api.ServiceSpec) error {
                if flags.Changed("tmpfs") {
                    tmpfss, err := flags.GetStringSlice("tmpfs")
                    if err != nil {
                        return err
            Severity: Major
            Found in swarmd/cmd/swarmctl/service/flagparser/tmpfs.go - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language