cloudfoundry/stratos

View on GitHub
src/jetstream/plugins/cfapppush/deploy.go

Summary

Maintainability
D
3 days
Test Coverage

Function getFolderSource has a Cognitive Complexity of 30 (exceeds 8 allowed). Consider refactoring.
Open

func getFolderSource(clientWebSocket *websocket.Conn, tempDir string, msg SocketMessage) (StratosProject, string, error) {
    // The msg data is JSON for the Folder info
    info := FolderSourceInfo{
        WaitAfterUpload: false,
    }
Severity: Minor
Found in src/jetstream/plugins/cfapppush/deploy.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

Method CFAppPush.deploy has 121 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (cfAppPush *CFAppPush) deploy(echoContext echo.Context) error {

    cnsiGUID := echoContext.Param("cnsiGuid")
    orgGUID := echoContext.Param("orgGuid")
    spaceGUID := echoContext.Param("spaceGuid")
Severity: Major
Found in src/jetstream/plugins/cfapppush/deploy.go - About 3 hrs to fix

    File deploy.go has 562 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package cfapppush
    
    import (
        "encoding/base64"
        "encoding/json"
    Severity: Minor
    Found in src/jetstream/plugins/cfapppush/deploy.go - About 3 hrs to fix

      Function getFolderSource has 80 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func getFolderSource(clientWebSocket *websocket.Conn, tempDir string, msg SocketMessage) (StratosProject, string, error) {
          // The msg data is JSON for the Folder info
          info := FolderSourceInfo{
              WaitAfterUpload: false,
          }
      Severity: Major
      Found in src/jetstream/plugins/cfapppush/deploy.go - About 2 hrs to fix

        Method CFAppPush.getGitSCMSource has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
        Open

        func (cfAppPush *CFAppPush) getGitSCMSource(clientWebSocket *websocket.Conn, tempDir string, msg SocketMessage, userGUID string) (StratosProject, string, error) {
            var (
                err error
            )
        
        
        Severity: Minor
        Found in src/jetstream/plugins/cfapppush/deploy.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

        Method CFAppPush.getGitSCMSource has 67 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (cfAppPush *CFAppPush) getGitSCMSource(clientWebSocket *websocket.Conn, tempDir string, msg SocketMessage, userGUID string) (StratosProject, string, error) {
            var (
                err error
            )
        
        
        Severity: Minor
        Found in src/jetstream/plugins/cfapppush/deploy.go - About 1 hr to fix

          Method CFAppPush.deploy has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
          Open

          func (cfAppPush *CFAppPush) deploy(echoContext echo.Context) error {
          
              cnsiGUID := echoContext.Param("cnsiGuid")
              orgGUID := echoContext.Param("orgGuid")
              spaceGUID := echoContext.Param("spaceGuid")
          Severity: Minor
          Found in src/jetstream/plugins/cfapppush/deploy.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

          Method CFAppPush.deploy has 13 return statements (exceeds 4 allowed).
          Open

          func (cfAppPush *CFAppPush) deploy(echoContext echo.Context) error {
          
              cnsiGUID := echoContext.Param("cnsiGuid")
              orgGUID := echoContext.Param("orgGuid")
              spaceGUID := echoContext.Param("spaceGuid")
          Severity: Major
          Found in src/jetstream/plugins/cfapppush/deploy.go - About 1 hr to fix

            Function getFolderSource has 12 return statements (exceeds 4 allowed).
            Open

            func getFolderSource(clientWebSocket *websocket.Conn, tempDir string, msg SocketMessage) (StratosProject, string, error) {
                // The msg data is JSON for the Folder info
                info := FolderSourceInfo{
                    WaitAfterUpload: false,
                }
            Severity: Major
            Found in src/jetstream/plugins/cfapppush/deploy.go - About 1 hr to fix

              Function fetchManifest has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
              Open

              func fetchManifest(repoPath string, stratosProject StratosProject, clientWebSocket *websocket.Conn) (Applications, string, error) {
              
                  var manifest Applications
              
                  // Can be either manifest.yml or manifest.yaml
              Severity: Minor
              Found in src/jetstream/plugins/cfapppush/deploy.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

              Method CFAppPush.getConfigData has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func (cfAppPush *CFAppPush) getConfigData(echoContext echo.Context, cnsiGUID string, orgGUID string, spaceGUID string, spaceName string, orgName string, clientWebSocket *websocket.Conn) (*CFPushAppConfig, error) {
              Severity: Major
              Found in src/jetstream/plugins/cfapppush/deploy.go - About 50 mins to fix

                Method CFAppPush.getGitSCMSource has 7 return statements (exceeds 4 allowed).
                Open

                func (cfAppPush *CFAppPush) getGitSCMSource(clientWebSocket *websocket.Conn, tempDir string, msg SocketMessage, userGUID string) (StratosProject, string, error) {
                    var (
                        err error
                    )
                
                
                Severity: Major
                Found in src/jetstream/plugins/cfapppush/deploy.go - About 45 mins to fix

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

                  func fetchManifest(repoPath string, stratosProject StratosProject, clientWebSocket *websocket.Conn) (Applications, string, error) {
                  
                      var manifest Applications
                  
                      // Can be either manifest.yml or manifest.yaml
                  Severity: Major
                  Found in src/jetstream/plugins/cfapppush/deploy.go - About 35 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status