Showing 70 of 2,037 total issues
LocalStoreManager
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export class LocalStoreManager {
private static syncListenerInitialised = false;
private syncKeys: string[] = [];
File create.page.ts
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Component, OnInit, Input, isDevMode, ElementRef, ViewChild } from '@angular/core';
import { ChainDb, Block, SchemaAction, DataAction, SchemaColumnDefinition, SchemaActionEnum, DataActionEnum, ColumnData, LockTarget, LockTargetEnum, SchemaColumnType, LockPermissionEnum } from '../../models/chain-db.model';
import { ChainDbService } from '../../services/chain-db.service';
import { Router, ParamMap, ActivatedRoute } from '@angular/router';
import { AlertService, MessageSeverity, DialogType } from '../../services/alert.service';
File utilities.ts
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Injectable, isDevMode } from '@angular/core';
import { Response } from '@angular/http';
import { Lightbox } from "angular2-lightbox";
import { AlertService, MessageSeverity } from './alert.service';
import { PaginationType } from '../models/pager.model';
File chain-db.service.ts
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Injectable, Injector } from '@angular/core';
import { Observable } from "rxjs/Observable";
import 'rxjs/add/observable/of';
import { ConfigurationService } from "./configuration.service";
import { EndpointFactory } from "./endpoint-factory.service";
Consider simplifying this complex logical expression. Open
if ([46, 8, 9, 27, 13, 110, 190].indexOf(e.keyCode) !== -1 ||
// Allow: Ctrl+A
(e.keyCode === 65 && (e.ctrlKey || e.metaKey)) ||
// Allow: Ctrl+C
(e.keyCode === 67 && (e.ctrlKey || e.metaKey)) ||
Function getLockTargets
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
static getLockTargets(arr: Array<LockTargetCreationType>): Array<LockTarget> {
let getDataType = (type: LockTargetCreationTypeEnum): LockTargetEnum =>
type == "database" ? "Database"
: type == "schema" ? "TableSchema"
: type == "row" ? "TableRowData"
- 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 getLockTargetCreationTypes
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
static getLockTargetCreationTypes(targets: Array<LockTarget>): Array<LockTargetCreationType> {
let getDataType = (type: LockTargetEnum): LockTargetCreationTypeEnum =>
type == "Database" ? "database"
: type == "TableSchema" ? "schema"
: type == "TableRowData" ? "row"
- 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 exports
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (env) => {
const extractCSS = new ExtractTextPlugin('vendor.css');
const isDevBuild = !(env && env.prod);
const sharedConfig = {
stats: { modules: false },
AuthService
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export class AuthService {
public get loginUrl() { return this.configurations.loginUrl; }
Function generateActions
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
generateActions(txs: Array<Tx>) {
if (!txs) {
this.dataActions = [];
this.schemaActions = [];
this.lockTxs = [];
- 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
Utilities
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export class Utilities {
public static readonly captionAndMessageSeparator = ":";
public static readonly noNetworkMessageCaption = "无网络";
Function generateNotification
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
private generateNotification(alarms: Array<AlarmConfiguration>): Observable<Array<AlarmConfiguration>> {
var dbArray = alarms
.map(_ => _.dbid)
.filter((v, i, a) => a.indexOf(v) === i);
for (var i = 0; i < dbArray.length; i++) {
- 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
ChainDbService
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export class ChainDbService extends EndpointFactory {
private readonly _baseUrl: string = "";
get baseUrl() { return this.configurations.baseUrl + this._baseUrl; }
Function exports
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (env) => {
// Configuration in common to both client-side and server-side bundles
const isDevBuild = !(env && env.prod);
const extractCSS = new ExtractTextPlugin('vendor.css');
const sharedConfig = {
File login.page.ts
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Component, OnInit, OnDestroy, Input, Inject, isDevMode } from "@angular/core";
import { DOCUMENT } from '@angular/platform-browser';
import { AlertService, MessageSeverity, DialogType } from '../../services/alert.service';
import { AuthService } from "../../services/auth.service";
Function constructor
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
private alertService: AlertService,
private authService: AuthService,
private configurations: ConfigurationService,
private translationService: AppTranslationService,
Function getHttpResponseMessage
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public static getHttpResponseMessage(data: Response | any): string[] {
let responses: string[] = [];
if (data instanceof Response) {
- 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 constructor
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(private location: Location,
titleService: Title,
private router: Router,
private authService: AuthService,
private alertService: AlertService,
Function findHttpResponseMessage
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static findHttpResponseMessage(messageToFind: string, data: Response | any, seachInCaptionOnly = true, includeCaptionInResult = false): string {
let searchString = messageToFind.toLowerCase();
let httpMessages = this.getHttpResponseMessage(data);
- 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 getActionDefinitions
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
static getActionDefinitions(translationService: AppTranslationService) {
let gT = (key: string) => translationService.getTranslation(key);
let baseActionDef = {
filter: { inputClass: "hidden" },
attr: { class: "table table-bordered table-reset" },