Showing 718 of 1,370 total issues
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")
- 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 Analysis.OnEndpointNotification
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
func (analysis *Analysis) OnEndpointNotification(action interfaces.EndpointAction, endpoint *interfaces.CNSIRecord) {
if action == interfaces.EndpointUnregisterAction {
// An endpoint was unregistered, so remove all reports
dbStore, err := store.NewAnalysisDBStore(analysis.portalProxy.GetDatabaseConnection())
if err == 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 TokenStore.FindCNSIToken
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
func (d *TokenStore) FindCNSIToken(cnsiGUID string, userGUID string, encryptionKey []byte) (interfaces.TokenRecord, error) {
// Main method that we need to override to get the token for the given endpoint
local, err := ListCloudFoundry()
if err == 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
Function MigrateSetupData
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
func MigrateSetupData(portal interfaces.PortalProxy, configStore Repository) error {
// Determine if we need to migrate data first
_, ok, err := configStore.GetValue(systemGroupName, configSetupNeededMarker)
if err != 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 KubeConfigFile.GetUserForCluster
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
func (k *KubeConfigFile) GetUserForCluster(clusterEndpoint string) (*KubeConfigUser, error) {
var cluster *KubeConfigCluster
var err error
- 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.RefreshOidcToken
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
func (p *portalProxy) RefreshOidcToken(skipSSLValidation bool, cnsiGUID, userGUID, client, clientSecret, tokenEndpoint string) (t interfaces.TokenRecord, err error) {
log.Debug("RefreshOidcToken")
userToken, ok := p.GetCNSITokenRecordWithDisconnected(cnsiGUID, userGUID)
if !ok {
return t, fmt.Errorf("Info could not be found for user with GUID %s", userGUID)
- 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 ConsoleConfigRepository.GetConsoleConfig
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
func (c *ConsoleConfigRepository) GetConsoleConfig() (*interfaces.ConsoleConfig, error) {
log.Debug("Get ConsoleConfig")
rows, err := c.db.Query(getConsoleConfig)
if err != nil {
return nil, fmt.Errorf("Unable to retrieve console config record: %v", 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 ApplyMigrations
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
func ApplyMigrations(conf *goose.DBConf, db *sql.DB) error {
current, err := goose.EnsureDBVersion(conf, db)
if err != nil {
return fmt.Errorf("Failed to get database version: %s", err.Error())
}
- 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 paginate
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
function paginate(action, state: PaginationState = {}, updatePagination) {
if (action.type === ApiActionTypes.API_REQUEST_START) {
return 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 ngOnInit
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
ngOnInit() {
this.endpointId = this.activatedRoute.snapshot.params && this.activatedRoute.snapshot.params.endpointId ?
this.activatedRoute.snapshot.params.endpointId : null;
if (!this.endpointIds$ && this.endpointId) {
this.endpointIds$ = observableOf([this.endpointId]);
- 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 update
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
private update() {
this.initials = null;
this.gravatar = null;
const user = this.userInfo;
- 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 init
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func init() {
RegisterMigration(20170818120003, "InitialSchema", func(txn *sql.Tx, conf *goose.DBConf) error {
binaryDataType := "BYTEA"
if strings.Contains(conf.Driver.Name, "mysql") {
binaryDataType = "BLOB"
Function testListMissingListRequired
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function testListMissingListRequired(done: () => void) {
const getOrgAction = new GetOrganization(orgGuid, cfGuid, [createEntityRelationKey(organizationEntityType, spaceEntityType)], true);
const childSpaceToOrgRelation = new EntityTreeRelation(cfEntityFactory(spaceEntityType), true, 'spaces', 'entity.spaces', []);
const parentOrgToSpaceRelation = new EntityTreeRelation(getOrgAction.entity[0], true, null, '', [childSpaceToOrgRelation]);
Function createCfOrSpaceMultipleFilterFn
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const createCfOrSpaceMultipleFilterFn = (
store: Store<CFAppState>,
action: PaginatedAction,
setQParam: (setQ: QParam, qs: QParam[]) => boolean,
preResetUpdate?: () => void
Function configureForEditServiceInstanceMode
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private configureForEditServiceInstanceMode() {
const { endpointId, serviceInstanceId } = this.activatedRoute.snapshot.params;
if (this.serviceType === this.serviceTypes.USER_SERVICE) {
this.serviceInstanceId = serviceInstanceId;
this.title$ = observableOf('Edit User Provided Service Instance');
Function succeedRequest
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function succeedRequest(state: BaseRequestState, action: ISuccessRequestAction) {
if (!isNullOrUndefined(action.apiAction.guid)) {
const apiAction = action.apiAction as BaseEntityRequestAction;
const successAction = action as WrapperRequestActionSuccess;
const requestSuccessState = getEntityRequestState(state, apiAction);
Function processObject
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processObject(object: any, output?: any, nested?: boolean) {
if (nested && output) {
output = { properties: output };
} else {
output = output || {};
Function setupObservables
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private setupObservables() {
this.metricsEndpoints$ = this.endpointsMonitor.currentPage$.pipe(
map((endpoints: any) => {
const result: MetricsEndpointProvider[] = [];
const metrics = endpoints.filter(e => e.cnsi_type === 'metrics');
Function map
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public map() {
if (!this.report.report || !this.report.report.popeye) {
return;
}
Function ngOnInit
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit(): void {
// Has the endpoint ID been specified in the URL?
const endpoint = this.activatedRoute.snapshot.queryParams[AUTO_SELECT_CF_URL_PARAM];
if (endpoint) {
this.cfOrgSpaceService.cf.select.next(endpoint);