asteris-llc/converge

View on GitHub
resource/docker/container/container_test.go

Summary

Maintainability
F
4 days
Test Coverage

Function TestContainerCheck has 556 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestContainerCheck(t *testing.T) {
    t.Parallel()
    defer logging.HideLogs(t)()

    t.Run("container not found", func(t *testing.T) {
Severity: Major
Found in resource/docker/container/container_test.go - About 2 days to fix

    File container_test.go has 617 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    // Copyright © 2016 Asteris, LLC
    //
    // Licensed under the Apache License, Version 2.0 (the "License");
    // you may not use this file except in compliance with the License.
    // You may obtain a copy of the License at
    Severity: Minor
    Found in resource/docker/container/container_test.go - About 4 hrs to fix

      Function TestContainerCheck has 40 return statements (exceeds 4 allowed).
      Open

      func TestContainerCheck(t *testing.T) {
          t.Parallel()
          defer logging.HideLogs(t)()
      
          t.Run("container not found", func(t *testing.T) {
      Severity: Major
      Found in resource/docker/container/container_test.go - About 3 hrs to fix

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

            t.Run("dns change", func(t *testing.T) {
                c := &fakeAPIClient{
                    FindContainerFunc: func(name string) (*dc.Container, error) {
                        return &dc.Container{
                            Name:   name,
        Severity: Major
        Found in resource/docker/container/container_test.go and 1 other location - About 4 hrs to fix
        resource/docker/container/container_test.go on lines 595..622

        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 312.

        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

            t.Run("volumes from change", func(t *testing.T) {
                c := &fakeAPIClient{
                    FindContainerFunc: func(name string) (*dc.Container, error) {
                        return &dc.Container{
                            Name:   name,
        Severity: Major
        Found in resource/docker/container/container_test.go and 1 other location - About 4 hrs to fix
        resource/docker/container/container_test.go on lines 495..525

        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 312.

        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

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

        type fakeAPIClient struct {
            FindImageFunc       func(repoTag string) (*dc.Image, error)
            PullImageFunc       func(name, tag string) error
            FindContainerFunc   func(name string) (*dc.Container, error)
            CreateContainerFunc func(opts dc.CreateContainerOptions) (*dc.Container, error)
        Severity: Major
        Found in resource/docker/container/container_test.go and 1 other location - About 1 hr to fix
        resource/docker/image/image_test.go on lines 143..150

        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 168.

        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

        There are no issues that match your filters.

        Category
        Status