File main.go
has 891 lines of code (exceeds 500 allowed). Consider refactoring. Open
package main
import (
"crypto/sha1"
"crypto/tls"
Function main
has 183 lines of code (exceeds 50 allowed). Consider refactoring. Open
func main() {
// Register time.Time in gob
gob.Register(time.Time{})
Function main
has a Cognitive Complexity of 37 (exceeds 8 allowed). Consider refactoring. Open
func main() {
// Register time.Time in gob
gob.Register(time.Time{})
- 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.registerRoutes
has 99 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *portalProxy) registerRoutes(e *echo.Echo, needSetupMiddleware bool) {
log.Debug("registerRoutes")
e.GET("/swagger/*", echoSwagger.WrapHandler)
Method portalProxy.registerRoutes
has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring. Open
func (p *portalProxy) registerRoutes(e *echo.Echo, needSetupMiddleware bool) {
log.Debug("registerRoutes")
e.GET("/swagger/*", echoSwagger.WrapHandler)
- 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
Function newPortalProxy
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func newPortalProxy(pc interfaces.PortalConfig, dcp *sql.DB, ss HttpSessionStore, sessionStoreOptions *sessions.Options, env *env.VarSet) *portalProxy {
log.Debug("newPortalProxy")
// Generate cookie name - avoids issues if the cookie domain is changed
cookieName := jetstreamSessionName
Function start
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
func start(config interfaces.PortalConfig, p *portalProxy, needSetupMiddleware bool, isUpgrade bool, envLookup *env.VarSet) error {
log.Debug("start")
e := echo.New()
e.HideBanner = true
e.HidePort = true
Function start
has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring. Open
func start(config interfaces.PortalConfig, p *portalProxy, needSetupMiddleware bool, isUpgrade bool, envLookup *env.VarSet) error {
log.Debug("start")
e := echo.New()
e.HideBanner = true
e.HidePort = true
- 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
Function echoV2DefaultHTTPErrorHandler
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
func echoV2DefaultHTTPErrorHandler(err error, c echo.Context) {
code := http.StatusInternalServerError
msg := http.StatusText(code)
if he, ok := err.(*echo.HTTPError); ok {
- 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
Function detectTLSCert
has 6 return statements (exceeds 4 allowed). Open
func detectTLSCert(pc interfaces.PortalConfig) (string, string, error) {
log.Debug("detectTLSCert")
certFilename := "pproxy.crt"
certKeyFilename := "pproxy.key"
Function start
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func start(config interfaces.PortalConfig, p *portalProxy, needSetupMiddleware bool, isUpgrade bool, envLookup *env.VarSet) error {
Function newPortalProxy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func newPortalProxy(pc interfaces.PortalConfig, dcp *sql.DB, ss HttpSessionStore, sessionStoreOptions *sessions.Options, env *env.VarSet) *portalProxy {
Function initSessionStore
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func initSessionStore(db *sql.DB, databaseProvider string, pc interfaces.PortalConfig, sessionExpiry int, env *env.VarSet) (HttpSessionStore, *sessions.Options, error) {
Function detectTLSCert
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
func detectTLSCert(pc interfaces.PortalConfig) (string, string, error) {
log.Debug("detectTLSCert")
certFilename := "pproxy.crt"
certKeyFilename := "pproxy.key"
- 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"