cloudfoundry/stratos

View on GitHub
src/jetstream/authcnsi.go

Summary

Maintainability
D
1 day
Test Coverage

Method portalProxy.DoLoginToCNSI has a Cognitive Complexity of 46 (exceeds 8 allowed). Consider refactoring.
Open

func (p *portalProxy) DoLoginToCNSI(c echo.Context, cnsiGUID string, systemSharedToken bool) (*interfaces.LoginRes, error) {

    cnsiRecord, err := p.GetCNSIRecord(cnsiGUID)
    if err != nil {
        return nil, interfaces.NewHTTPShadowError(
Severity: Minor
Found in src/jetstream/authcnsi.go - About 6 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 portalProxy.DoLoginToCNSI has 99 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (p *portalProxy) DoLoginToCNSI(c echo.Context, cnsiGUID string, systemSharedToken bool) (*interfaces.LoginRes, error) {

    cnsiRecord, err := p.GetCNSIRecord(cnsiGUID)
    if err != nil {
        return nil, interfaces.NewHTTPShadowError(
Severity: Major
Found in src/jetstream/authcnsi.go - About 2 hrs to fix

    Method portalProxy.DoLoginToCNSI has 12 return statements (exceeds 4 allowed).
    Open

    func (p *portalProxy) DoLoginToCNSI(c echo.Context, cnsiGUID string, systemSharedToken bool) (*interfaces.LoginRes, error) {
    
        cnsiRecord, err := p.GetCNSIRecord(cnsiGUID)
        if err != nil {
            return nil, interfaces.NewHTTPShadowError(
    Severity: Major
    Found in src/jetstream/authcnsi.go - About 1 hr to fix

      Method portalProxy.DoLoginToCNSIwithConsoleUAAtoken has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
      Open

      func (p *portalProxy) DoLoginToCNSIwithConsoleUAAtoken(c echo.Context, theCNSIrecord interfaces.CNSIRecord) error {
          userID, err := p.GetSessionStringValue(c, "user_id")
          if err != nil {
              return errors.New("could not find correct session value")
          }
      Severity: Minor
      Found in src/jetstream/authcnsi.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 portalProxy.DoLoginToCNSIwithConsoleUAAtoken has 7 return statements (exceeds 4 allowed).
      Open

      func (p *portalProxy) DoLoginToCNSIwithConsoleUAAtoken(c echo.Context, theCNSIrecord interfaces.CNSIRecord) error {
          userID, err := p.GetSessionStringValue(c, "user_id")
          if err != nil {
              return errors.New("could not find correct session value")
          }
      Severity: Major
      Found in src/jetstream/authcnsi.go - About 45 mins to fix

        Method portalProxy.logoutOfCNSI has 6 return statements (exceeds 4 allowed).
        Open

        func (p *portalProxy) logoutOfCNSI(c echo.Context) error {
            log.Debug("logoutOfCNSI")
        
            cnsiGUID := c.Param("cnsi_guid")
        
        
        Severity: Major
        Found in src/jetstream/authcnsi.go - About 40 mins to fix

          Method portalProxy.ssoLoginToCNSI has 6 return statements (exceeds 4 allowed).
          Open

          func (p *portalProxy) ssoLoginToCNSI(c echo.Context) error {
              log.Debug("ssoLoginToCNSI")
              endpointGUID := c.QueryParam("guid")
              if len(endpointGUID) == 0 {
                  return interfaces.NewHTTPShadowError(
          Severity: Major
          Found in src/jetstream/authcnsi.go - About 40 mins to fix

            Method portalProxy.loginToCNSI has 5 return statements (exceeds 4 allowed).
            Open

            func (p *portalProxy) loginToCNSI(c echo.Context) error {
                log.Debug("loginToCNSI")
            
                var systemSharedToken = false
            
            
            Severity: Major
            Found in src/jetstream/authcnsi.go - About 35 mins to fix

              Method portalProxy.logoutOfCNSI has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
              Open

              func (p *portalProxy) logoutOfCNSI(c echo.Context) error {
                  log.Debug("logoutOfCNSI")
              
                  cnsiGUID := c.Param("cnsi_guid")
              
              
              Severity: Minor
              Found in src/jetstream/authcnsi.go - About 25 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

              TODO found
              Open

                  // TODO should be an extension point
              Severity: Minor
              Found in src/jetstream/authcnsi.go by fixme

              There are no issues that match your filters.

              Category
              Status