cpg1111/maestro

View on GitHub
pipeline/build.go

Summary

Maintainability
C
7 hrs
Test Coverage

Function runServiceBuild has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
Open

func runServiceBuild(srvs map[string]*DepService, stateCom *statecom.StateCom, testAll, shouldDeploy *bool) error {
    doneChan := make(chan string)
    errChan := make(chan error)
    buildTotal := 0
    for i := range srvs {
Severity: Minor
Found in pipeline/build.go - About 3 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 build has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

func build(srv *DepService, index string, stateCom *statecom.StateCom, done chan string, errChan chan error, shouldDeploy *bool) {
Severity: Minor
Found in pipeline/build.go - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if total < buildTotal {
                            siblingFailed = true
                            continue
                        }
    Severity: Major
    Found in pipeline/build.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if runErr != nil {
                              return runErr
                          }
      Severity: Major
      Found in pipeline/build.go - About 45 mins to fix

        Function Run has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func Run(depTree *DepTree, repo *git.Repository, stateCom *statecom.StateCom, lastBuildCommit, currBuildCommit *string, testAll, shouldDeploy *bool) error {
        Severity: Minor
        Found in pipeline/build.go - About 35 mins to fix

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

          func runServiceBuild(srvs map[string]*DepService, stateCom *statecom.StateCom, testAll, shouldDeploy *bool) error {
              doneChan := make(chan string)
              errChan := make(chan error)
              buildTotal := 0
              for i := range srvs {
          Severity: Major
          Found in pipeline/build.go - About 35 mins to fix

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

            func build(srv *DepService, index string, stateCom *statecom.StateCom, done chan string, errChan chan error, shouldDeploy *bool) {
                buildName := srv.build.conf.Name
                stateCom.Services[buildName].SetState("building", true)
                err := srv.build.execBuild()
                if err != nil {
            Severity: Major
            Found in pipeline/build.go - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status