RackHD/on-web-ui

View on GitHub
src/app/solution-center/os-install/os-install.component.ts

Summary

Maintainability
F
5 days
Test Coverage

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

    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 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 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 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            getNodeSku(node): Observable<string> {
              let hasSkuId = !!node.sku;
              let isComputeWithoutSku = (node.sku === null) && node.type === "compute";
              if (hasSkuId) {
                return this.skuService.getByIdentifier(node.sku.split("/").pop())
          Severity: Major
          Found in src/app/solution-center/os-install/os-install.component.ts and 1 other location - About 7 hrs to fix
          src/app/workflow-center/run-workflow/run-workflow.component.ts on lines 119..131

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 193.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              let list = _.map(nodes, node => {
                return forkJoin(
                  this.getNodeSku(node).pipe(catchError( () => of(null))),
                  this.getNodeObm(node).pipe(catchError( () => of(null))),
                  this.getNodeTag(node).pipe(catchError( () => of(null)))
          Severity: Major
          Found in src/app/solution-center/os-install/os-install.component.ts and 1 other location - About 7 hrs to fix
          src/app/workflow-center/run-workflow/run-workflow.component.ts on lines 158..170

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 175.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

            getNodeObm(node): Observable<string> {
              if (!_.isEmpty(node.obms)) {
                let obmId = node.obms[0].ref.split("/").pop();
                return this.obmService.getByIdentifier(obmId)
                  .pipe( map(data => data.config.host) );
          Severity: Major
          Found in src/app/solution-center/os-install/os-install.component.ts and 1 other location - About 4 hrs to fix
          src/app/workflow-center/run-workflow/run-workflow.component.ts on lines 133..141

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 124.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

            getNodeTag(node): Observable<string> {
              if (!_.isEmpty(node.tags)) {
                return this.tagService.getTagByNodeId(node.id)
                  .pipe(
                    map(data => {
          Severity: Major
          Found in src/app/solution-center/os-install/os-install.component.ts and 1 other location - About 4 hrs to fix
          src/app/workflow-center/run-workflow/run-workflow.component.ts on lines 143..155

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 117.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              return forkJoin(list)
              .subscribe((data) => {
                this.allNodes = _.cloneDeep(nodes);
                this.nodeStore = _.cloneDeep(nodes);
                this.selNodeStore = _.cloneDeep(nodes);
          Severity: Major
          Found in src/app/solution-center/os-install/os-install.component.ts and 1 other location - About 2 hrs to fix
          src/app/workflow-center/run-workflow/run-workflow.component.ts on lines 172..177

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 76.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

            onFilterRefresh() {
              this.selNodeStore = [];
              setTimeout(() => {
                this.nodeStore = _.cloneDeep(this.allNodes);
                this.selNodeStore = _.cloneDeep(this.allNodes);
          Severity: Major
          Found in src/app/solution-center/os-install/os-install.component.ts and 1 other location - About 1 hr to fix
          src/app/workflow-center/run-workflow/run-workflow.component.ts on lines 240..246

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 74.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            constructor(
              public nodeService: NodeService,
              public catalogsService: CatalogsService,
              public workflowService: WorkflowService,
              private obmService: ObmService,
          Severity: Major
          Found in src/app/solution-center/os-install/os-install.component.ts and 1 other location - About 1 hr to fix
          src/app/management-center/nodes/nodes.component.ts on lines 75..82

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 71.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              let searchTrigger = this.searchTerms.pipe(
                debounceTime(300),
                distinctUntilChanged(),
                switchMap((term: string) => {
                  this.searchIterm(term);
          Severity: Major
          Found in src/app/solution-center/os-install/os-install.component.ts and 2 other locations - About 1 hr to fix
          src/app/inventory/dropdown-group/dropdown-group.component.ts on lines 83..90
          src/app/inventory/header/header.component.ts on lines 33..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 56.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status