jkawamoto/loci

View on GitHub

Showing 24 of 61 total issues

Function run has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring.
Open

func run(opt *RunOpt) (err error) {

    // Prepare to be canceled.
    ctx, cancel := context.WithCancel(context.Background())
    defer cancel()
Severity: Minor
Found in command/run.go - About 1 day 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 run has 193 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func run(opt *RunOpt) (err error) {

    // Prepare to be canceled.
    ctx, cancel := context.WithCancel(context.Background())
    defer cancel()
Severity: Major
Found in command/run.go - About 6 hrs to fix

    Function TestGoArgumentSet has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
    Open

    func TestGoArgumentSet(t *testing.T) {
    
        var (
            travis *Travis
            res    TestCaseSet
    Severity: Minor
    Found in command/travis_go_test.go - About 5 hrs 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 TestPythonArgumentSet has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
    Open

    func TestPythonArgumentSet(t *testing.T) {
    
        var (
            travis *Travis
            res    TestCaseSet
    Severity: Minor
    Found in command/travis_python_test.go - About 4 hrs 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 TestGoArgumentSet has 140 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func TestGoArgumentSet(t *testing.T) {
    
        var (
            travis *Travis
            res    TestCaseSet
    Severity: Major
    Found in command/travis_go_test.go - About 4 hrs to fix

      Function TestPythonArgumentSet has 120 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func TestPythonArgumentSet(t *testing.T) {
      
          var (
              travis *Travis
              res    TestCaseSet
      Severity: Major
      Found in command/travis_python_test.go - About 3 hrs to fix

        Function TestPythonOverwriteEvnSet has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
        Open

        func TestPythonOverwriteEvnSet(t *testing.T) {
        
            var err error
            // The following configuration is copied from matplotlib.
            travis, err := NewTravis([]byte(`language: "python"
        Severity: Minor
        Found in command/travis_python_test.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

        Function run has 19 return statements (exceeds 4 allowed).
        Open

        func run(opt *RunOpt) (err error) {
        
            // Prepare to be canceled.
            ctx, cancel := context.WithCancel(context.Background())
            defer cancel()
        Severity: Major
        Found in command/run.go - About 1 hr to fix

          Function TestPythonOverwriteEvnSet has 67 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func TestPythonOverwriteEvnSet(t *testing.T) {
          
              var err error
              // The following configuration is copied from matplotlib.
              travis, err := NewTravis([]byte(`language: "python"
          Severity: Minor
          Found in command/travis_python_test.go - About 1 hr to fix

            Method Travis.argumentSetPython has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
            Open

            func (t *Travis) argumentSetPython(logger io.Writer) (res TestCaseSet, err error) {
            
                res = make(TestCaseSet)
                global := parseEnv(strings.Join(t.Env.Global, " "))
            
            
            Severity: Minor
            Found in command/travis_python.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

            Function Archive has 9 return statements (exceeds 4 allowed).
            Open

            func Archive(ctx context.Context, dir string, filename string) (err error) {
            
                writeFile, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0600)
                if err != nil {
                    return
            Severity: Major
            Found in command/archive.go - About 55 mins to fix

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

              func (t *Travis) argumentSetGo() (res TestCaseSet, err error) {
              
                  res = make(TestCaseSet)
                  global := parseEnv(strings.Join(t.Env.Global, " "))
              
              
              Severity: Minor
              Found in command/travis_go.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

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

              func TestArchive(t *testing.T) {
              
                  temp := os.TempDir()
                  target := path.Join(temp, "test.tar.gz")
                  t.Logf("Creating an archive file: %s", target)
              Severity: Major
              Found in command/archive_test.go - About 45 mins to fix

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

                func Start(ctx context.Context, tag, name string, env []string, output io.Writer) (err error) {
                
                    // Create a docker client.
                    cli, err := client.NewEnvClient()
                    if err != nil {
                Severity: Major
                Found in command/docker.go - About 45 mins to fix

                  Function Dockerfile has 6 return statements (exceeds 4 allowed).
                  Open

                  func Dockerfile(travis *Travis, opt *DockerfileOpt, archive string) (res []byte, err error) {
                  
                      var data []byte
                  
                      // Loading the base template.
                  Severity: Major
                  Found in command/docker.go - About 40 mins to fix

                    Function archiveContext has 6 return statements (exceeds 4 allowed).
                    Open

                    func archiveContext(ctx context.Context, root string, writer io.Writer) (err error) {
                    
                        // Create a buffered writer.
                        bufWriter := bufio.NewWriter(writer)
                        defer bufWriter.Flush()
                    Severity: Major
                    Found in command/docker.go - About 40 mins to fix

                      Function NewDisplay has 6 return statements (exceeds 4 allowed).
                      Open

                      func NewDisplay(ctx context.Context, title string, maxSection int) (display *Display, nctx context.Context, err error) {
                      
                          g, err := gocui.NewGui(gocui.OutputNormal)
                          if err != nil {
                              return
                      Severity: Major
                      Found in command/display.go - About 40 mins to fix

                        Function RestoreAsset has 6 return statements (exceeds 4 allowed).
                        Open

                        func RestoreAsset(dir, name string) error {
                            data, err := Asset(name)
                            if err != nil {
                                return err
                            }
                        Severity: Major
                        Found in command/assets.go - About 40 mins to fix

                          Function Entrypoint has 5 return statements (exceeds 4 allowed).
                          Open

                          func Entrypoint(travis *Travis) (res []byte, err error) {
                          
                              var (
                                  data []byte
                                  temp *template.Template
                          Severity: Major
                          Found in command/entrypoint.go - About 35 mins to fix

                            Method Display.Layout has 5 return statements (exceeds 4 allowed).
                            Open

                            func (d *Display) Layout(g *gocui.Gui) error {
                                if d.closed {
                                    return fmt.Errorf("Display has been closed already")
                                }
                            
                            
                            Severity: Major
                            Found in command/display.go - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language