Showing 718 of 1,370 total issues
Avoid too many return
statements within this function. Open
return 'none';
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return `${duration.asSeconds().toPrecision(2)} msec`;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return this.precisionIfUseful(mb) + ' MB';
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return true;
Method UserInvite.invite
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
func (invite *UserInvite) invite(c echo.Context) error {
log.Debug("Invite User")
cfGUID := c.Param("id")
// Check that there is an endpoint with the specified ID and that it is a Cloud Foundry endpoint
- 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 UserInvite.refreshToken
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
func (invite *UserInvite) refreshToken(clientID, clientSecret string, endpoint interfaces.CNSIRecord) (*interfaces.UAAResponse, *interfaces.TokenRecord, error) {
now := time.Now()
clientSecret = strings.TrimSpace(clientSecret)
authEndpoint := fmt.Sprintf("%s/oauth/token", endpoint.TokenEndpoint)
- 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 NewKubeTerminal
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
func NewKubeTerminal(p interfaces.PortalProxy) *KubeTerminal {
// Only enabled in tech preview
if !p.GetConfig().EnableTechPreview {
log.Info("Kube Terminal not enabled - requires tech preview")
return nil
- 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 UserInvite.AssociateSpaceRoles
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
func (invite *UserInvite) AssociateSpaceRoles(cnsiGUID, userID, newUserGUID string, inviteRequest *UserInviteReq) (*CFError, error) {
if inviteRequest.SpaceRoles.Auditor {
if cfError, err := invite.AssociateSpaceRoleForUser(cnsiGUID, userID, newUserGUID, inviteRequest.Space, "auditors"); err != nil {
return cfError, err
}
- 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 makePrometheusRequestInfos
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
func makePrometheusRequestInfos(c echo.Context, userGUID string, metrics map[string]EndpointMetricsRelation, prometheusOp string, queries string, addJob bool) []interfaces.ProxyRequestInfo {
// Construct the metadata for proxying
requests := make([]interfaces.ProxyRequestInfo, 0)
for _, metric := range metrics {
req := interfaces.ProxyRequestInfo{}
- 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 KubernetesSpecification.ProxyKubernetesAPI
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
func (c *KubernetesSpecification) ProxyKubernetesAPI(userID string, f KubeProxyFunc) (KubeProxyResponses, error) {
var p = c.portalProxy
k8sList := make([]*interfaces.ConnectedEndpoint, 0)
eps, err := p.ListEndpointsByUser(userID)
- 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 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"
Further reading
Function KubeDashboardStatus
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
func KubeDashboardStatus(p interfaces.PortalProxy, endpointGUID, userGUID string, includeToken bool) (*StatusResponse, error) {
status := &StatusResponse{
Endpoint: endpointGUID,
Installed: false,
- 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 NewConfigFileLookup
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
func NewConfigFileLookup(path string) env.Lookup {
// Check if the config file exists
if _, err := os.Stat(path); err != nil {
return env.NoopLookup
- 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.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
Method portalProxy.login
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
func (p *portalProxy) login(c echo.Context, skipSSLValidation bool, client string, clientSecret string, endpoint string) (uaaRes *interfaces.UAAResponse, u *interfaces.JWTUserTokenInfo, err error) {
log.Debug("login")
if c.Request().Method == http.MethodGet {
code := c.QueryParam("code")
state := c.QueryParam("state")
- 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 getSafeObservables
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
private getSafeObservables(
org$?: Observable<EntityInfo<APIResource<IOrganization>>>,
space$?: Observable<EntityInfo<APIResource<ISpace>>>
) {
if (space$ && org$) {
- 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"