Showing 1,111 of 1,370 total issues
Function ngOnInit
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
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 init
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
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 initServiceObservables
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private initServiceObservables() {
this.serviceEntityService = cfEntityCatalog.service.store.getEntityService(this.serviceGuid, this.cfGuid, {});
this.service$ = this.serviceEntityService.waitForEntity$.pipe(
filter(o => !!o && !!o.entity),
map(o => o.entity),
Function processObject
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function processObject(object: any, output?: any, nested?: boolean) {
if (nested && output) {
output = { properties: output };
} else {
output = output || {};
Function succeedRequest
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 map
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public map() {
if (!this.report.report || !this.report.report.popeye) {
return;
}
Function setupObservables
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 newPortalProxy
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
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 graph
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
).subscribe(([g, report]) => {
const newNodes: CustomHelmReleaseGraphNode[] = [];
Object.values(g.nodes).forEach((node: HelmReleaseGraphNode) => {
const colors = this.getColor(node.data.status);
const icon = getIcon(node.data.kind);
Function createCoreStore
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static createCoreStore<Y, ABC extends OrchestratedActionBuilders>(
actionOrchestrator: ActionOrchestrator<ABC>,
entityKey: string,
getSchema: (schema: string) => EntitySchema
): CoreEntityCatalogEntityStore<Y, ABC> {
Function start
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
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 apply
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public apply(webpackConfig: any, config: StratosConfig, options: any) {
// Generate the module file to import the appropriate extensions
const dir = path.join(config.rootDir, path.dirname(options.main));
const overrideFile = path.resolve(path.join(dir, './_custom-import.module.ts'));
Function initialiseObservables
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private initialiseObservables() {
this.org$ = this.cfUserService.isConnectedUserAdmin(this.cfGuid).pipe(
switchMap(isAdmin => {
const relations = [
createEntityRelationKey(organizationEntityType, spaceEntityType),
Function deleteOrgWarn
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
deleteOrgWarn() {
this.cfOrgService.org$.pipe(
map(org => org.entity.entity.name),
first()
).subscribe(name => {
Function constructor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
catalogEntity: StratosBaseCatalogEntity,
store: Store<any>
) {
super();
Function ngOnInit
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
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]);
Function updateUserMissingRoles
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function updateUserMissingRoles(users: IRequestEntityTypeState<APIResource<CfUser>>, action: APISuccessOrFailedAction<NormalizedResponse>) {
// At this point in the flow the request flow (APISuccessOrFailedAction), the users may or may not be in the store yet
// (via WrapperRequestActionSuccess). Therefore in order to avoid partial entities we need to stick the whole user set into the store
// including `missingRoles`.
const usersInResponse: IRequestEntityTypeState<APIResource<CfUser>> = action.response.entities[cfUserEntityType];
Function installChart
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
installChart(): Observable<StepOnNextResult> {
const endpoint = getMonocularEndpoint(this.route, null, null);
// Build the request body
const values: HelmInstallValues = {
...this.details.value,
Function mapPods
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private mapPods(pods: KubernetesPod[]): HelmReleaseChartData {
const podPhases: { [phase: string]: number, } = {};
const containers = {
ready: {
name: 'Ready',
Function load
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
load(): Observable<boolean> {
const guid = this.endpoint.guid;
const podsObs = kubeEntityCatalog.pod.store.getPaginationService(guid);
const pods$ = podsObs.entities$;
const nodesObs = kubeEntityCatalog.node.store.getPaginationService(guid);