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(
- Read upRead up
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(
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(
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")
}
- Read upRead up
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")
}
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")
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(
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
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")
- Read upRead up
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
- Exclude checks