uchaindb/UClient

View on GitHub

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[] = [];
Severity: Minor
Found in src/ClientApp/app/services/local-store-manager.service.ts - About 5 hrs to fix

    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';
    Severity: Minor
    Found in src/ClientApp/app/components/database/create.page.ts - About 4 hrs to fix

      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';
      Severity: Minor
      Found in src/ClientApp/app/services/utilities.ts - About 4 hrs to fix

        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";
        Severity: Minor
        Found in src/ClientApp/app/services/chain-db.service.ts - About 4 hrs to fix

          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)) ||
          Severity: Critical
          Found in src/ClientApp/app/directives/only-number.directive.ts - About 3 hrs to fix

            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"
            Severity: Minor
            Found in src/ClientApp/app/components/database/create.page.function.ts - About 3 hrs to fix

            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"
            Severity: Minor
            Found in src/ClientApp/app/components/database/create.page.function.ts - About 3 hrs to fix

            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 },
            Severity: Major
            Found in src/webpack.config.vendor.js - About 3 hrs to fix

              AuthService has 28 functions (exceeds 20 allowed). Consider refactoring.
              Open

              @Injectable()
              export class AuthService {
              
                  public get loginUrl() { return this.configurations.loginUrl; }
              
              
              Severity: Minor
              Found in src/ClientApp/app/services/auth.service.ts - About 3 hrs to fix

                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 = [];
                Severity: Minor
                Found in src/ClientApp/app/components/database/action.component.ts - About 3 hrs to fix

                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 = "无网络";
                Severity: Minor
                Found in src/ClientApp/app/services/utilities.ts - About 3 hrs to fix

                  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++) {
                  Severity: Minor
                  Found in src/ClientApp/app/services/alarm.service.ts - About 3 hrs to fix

                  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; }
                  
                  
                  Severity: Minor
                  Found in src/ClientApp/app/services/chain-db.service.ts - About 3 hrs to fix

                    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 = {
                    Severity: Major
                    Found in src/webpack.config.js - About 2 hrs to fix

                      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";
                      Severity: Minor
                      Found in src/ClientApp/app/components/user/login.page.ts - About 2 hrs to fix

                        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,
                        Severity: Major
                        Found in src/ClientApp/app/components/user/login.page.ts - About 2 hrs to fix

                          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) {
                          Severity: Minor
                          Found in src/ClientApp/app/services/utilities.ts - About 2 hrs to fix

                          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,
                          Severity: Major
                          Found in src/ClientApp/app/components/app/app.component.ts - About 2 hrs to fix

                            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);
                            
                            
                            Severity: Minor
                            Found in src/ClientApp/app/services/utilities.ts - About 2 hrs to fix

                            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" },
                            Severity: Major
                            Found in src/ClientApp/app/components/database/create.page.translation.ts - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language