RackHD/on-web-ui

View on GitHub

Showing 26 of 162 total issues

File os-install.component.ts has 416 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Component, OnInit } from '@angular/core';
import { Poller, Node, API_PATTERN, ADDR_PATTERN, REPO_PATTERN, IP_PATTERN, DNS_PATTERN } from 'app/models';
import { FormControl, FormGroup, FormBuilder, Validators } from '@angular/forms';
import {
  AlphabeticalComparator,
Severity: Minor
Found in src/app/solution-center/os-install/os-install.component.ts - About 6 hrs to fix

    Function init has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      init(connectCb, disconnectCb, clickCb){
        if(this.initialized) return;
        // inject hook actions
        TaskNode.prototype.onConnectionsChange = function(connection, slot, connected, link_info){
          if(connection===global.LiteGraph.OUTPUT){
    Severity: Minor
    Found in src/app/canvas-graph/node-extension.service.ts - About 4 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

    File canvas-graph.component.ts has 334 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {
      Component,
      ElementRef,
      EventEmitter,
      Input,
    Severity: Minor
    Found in src/app/canvas-graph/canvas-graph.component.ts - About 4 hrs to fix

      Function addNode has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        addNode() {
          // mothod 1 for keep current context
          let self = this;
      
          // this function is referenced from lightgraph src.
      Severity: Major
      Found in src/app/canvas-graph/canvas-graph.component.ts - About 3 hrs to fix

        OsInstallComponent has 27 functions (exceeds 20 allowed). Consider refactoring.
        Open

        @Component({
          selector: 'app-os-install',
          templateUrl: './os-install.component.html',
          styleUrls: ['./os-install.component.scss']
        })
        Severity: Minor
        Found in src/app/solution-center/os-install/os-install.component.ts - About 3 hrs to fix

          Function drawBackCanvas has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public static drawBackCanvas() {
              return function(){
                var canvas = this.bgcanvas;
                if (canvas.width != this.canvas.width ||
                  canvas.height != this.canvas.height) {
          Severity: Major
          Found in src/app/canvas-graph/canvas-helper.ts - About 2 hrs to fix

            File canvas-helper.ts has 278 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import * as _ from 'lodash';
            import { CONSTS } from '../../config/consts';
            
            const global = (window as any);
            
            
            Severity: Minor
            Found in src/app/canvas-graph/canvas-helper.ts - About 2 hrs to fix

              ObmComponent has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              @Component({
                selector: 'app-obm',
                templateUrl: './obm.component.html',
                styleUrls: ['./obm.component.scss']
              })
              Severity: Minor
              Found in src/app/management-center/obms/obm.component.ts - About 2 hrs to fix

                Function init has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  init(connectCb, disconnectCb, clickCb){
                    if(this.initialized) return;
                    // inject hook actions
                    TaskNode.prototype.onConnectionsChange = function(connection, slot, connected, link_info){
                      if(connection===global.LiteGraph.OUTPUT){
                Severity: Major
                Found in src/app/canvas-graph/node-extension.service.ts - About 2 hrs to fix

                  NodesComponent has 21 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  @Component({
                    selector: 'app-nodes',
                    templateUrl: './nodes.component.html',
                    styleUrls: ['./nodes.component.scss'],
                    encapsulation: ViewEncapsulation.None
                  Severity: Minor
                  Found in src/app/management-center/nodes/nodes.component.ts - About 2 hrs to fix

                    RunWorkflowComponent has 21 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    @Component({
                      selector: 'app-run-workflow',
                      templateUrl: './run-workflow.component.html',
                      styleUrls: ['./run-workflow.component.scss']
                    })
                    Severity: Minor
                    Found in src/app/workflow-center/run-workflow/run-workflow.component.ts - About 2 hrs to fix

                      HistoryWorkflowComponent has 21 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      @Component({
                        selector: 'app-history-workflow',
                        templateUrl: './history-workflow.component.html',
                        styleUrls: ['./history-workflow.component.scss'],
                        encapsulation: ViewEncapsulation.None

                        Function createPayloadOptions has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          createPayloadOptions(): object {
                            let tmpJson = {};
                            let generalJson = {};
                            let version = { 'version': this.payloadForm.value['version'] };
                            let repo = { 'repo': this.payloadForm.value['repoUrl'] };
                        Severity: Major
                        Found in src/app/solution-center/os-install/os-install.component.ts - About 2 hrs to fix

                          Function createSku has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            createSku(): void {
                              let jsonData = {};
                              this.skuForm.getRawValue();
                              let value = this.skuForm.value;
                              // data transform
                          Severity: Minor
                          Found in src/app/management-center/skus/sku.component.ts - About 1 hr to fix

                            Function createSku has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                              createSku(): void {
                                let jsonData = {};
                                this.skuForm.getRawValue();
                                let value = this.skuForm.value;
                                // data transform
                            Severity: Minor
                            Found in src/app/management-center/skus/sku.component.ts - About 1 hr 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 ngOnInit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              ngOnInit() {
                                this.OS_TYPE_VERSION = {
                                  'esxi': ['6.5', '6', '5.5'],
                                  'centos': ['7', '6.5'],
                                  'rhel': ['7.0', '7.1', '7.2'],
                            Severity: Minor
                            Found in src/app/solution-center/os-install/os-install.component.ts - About 1 hr to fix

                              Function generateRowPos has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public generateRowPos(colPosMatrix: any, waitOnsList: any): {[propName: string]: number} {
                                    let rowPosMatrix = {};
                                    let tasksSortedByCol = this.sortTaskByCol(colPosMatrix);
                                    let waitedBysMatrix = this.getWaitedBysMatrix(this.tasks);
                              
                              
                              Severity: Minor
                              Found in src/app/canvas-graph/canvas-helper.ts - About 1 hr to fix

                                Function upload has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  @ErrorHanlder()
                                  public upload(file: File, identifier?: string, method?: string): any {
                                    //Angular doesn't support upload formData with 'application/x-www-form-urlencoded'
                                    //RackHD files API only supports 'application/x-www-form-urlencoded' till now
                                    //Thus XMLHttpRequest() is used instead of HttpClient POST/PUT methods.
                                Severity: Minor
                                Found in src/app/utils/rackhd-http.ts - About 1 hr to fix

                                  Function createPayloadOptions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    createPayloadOptions(): object {
                                      let tmpJson = {};
                                      let generalJson = {};
                                      let version = { 'version': this.payloadForm.value['version'] };
                                      let repo = { 'repo': this.payloadForm.value['repoUrl'] };
                                  Severity: Minor
                                  Found in src/app/solution-center/os-install/os-install.component.ts - About 1 hr 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 afterClick has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    afterClick(e, node) {
                                      if (!node || !node.properties)
                                        return;
                                  
                                      let self = this;
                                  Severity: Minor
                                  Found in src/app/canvas-graph/canvas-graph.component.ts - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language