valor-software/ng2-dragula

View on GitHub
libs/ng2-dragula/src/components/dragula.service.ts

Summary

Maintainability
D
2 days
Test Coverage

File dragula.service.ts has 330 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Injectable, Optional } from '@angular/core';
import { Group } from '../Group';
import { DragulaOptions } from '../DragulaOptions';
import { Subject, Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
Severity: Minor
Found in libs/ng2-dragula/src/components/dragula.service.ts - About 3 hrs to fix

    Function handleModels has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private handleModels({ name, drake, options }: Group): void {
        let dragElm: any;
        let dragIndex: number;
        let dropIndex: number;
        drake.on('remove', (el: any, container: any, source: any) => {
    Severity: Major
    Found in libs/ng2-dragula/src/components/dragula.service.ts - About 3 hrs to fix

      Function setupEvents has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private setupEvents(group: Group): void {
          if (group.initEvents) {
            return;
          }
          group.initEvents = true;
      Severity: Major
      Found in libs/ng2-dragula/src/components/dragula.service.ts - About 2 hrs to fix

        Function emitter has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const emitter = (event: EventTypes) => {
              switch (event) {
                case EventTypes.Drag:
                  group.drake.on(event, (...args: any[]) => {
                    this.dispatch$.next({ event, name, args });
        Severity: Minor
        Found in libs/ng2-dragula/src/components/dragula.service.ts - About 1 hr to fix

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

                  case EventTypes.Drop:
                    group.drake.on(event, (...args: any[]) => {
                      this.dispatch$.next({ event, name, args });
                    });
                    break;
          Severity: Major
          Found in libs/ng2-dragula/src/components/dragula.service.ts and 6 other locations - About 1 hr to fix
          libs/ng2-dragula/src/components/dragula.service.ts on lines 314..318
          libs/ng2-dragula/src/components/dragula.service.ts on lines 325..329
          libs/ng2-dragula/src/components/dragula.service.ts on lines 335..339
          libs/ng2-dragula/src/components/dragula.service.ts on lines 341..345
          libs/ng2-dragula/src/components/dragula.service.ts on lines 346..350
          libs/ng2-dragula/src/components/dragula.service.ts on lines 352..356

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

          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 7 locations. Consider refactoring.
          Open

                  case EventTypes.Drag:
                    group.drake.on(event, (...args: any[]) => {
                      this.dispatch$.next({ event, name, args });
                    });
                    break;
          Severity: Major
          Found in libs/ng2-dragula/src/components/dragula.service.ts and 6 other locations - About 1 hr to fix
          libs/ng2-dragula/src/components/dragula.service.ts on lines 319..323
          libs/ng2-dragula/src/components/dragula.service.ts on lines 325..329
          libs/ng2-dragula/src/components/dragula.service.ts on lines 335..339
          libs/ng2-dragula/src/components/dragula.service.ts on lines 341..345
          libs/ng2-dragula/src/components/dragula.service.ts on lines 346..350
          libs/ng2-dragula/src/components/dragula.service.ts on lines 352..356

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

          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 7 locations. Consider refactoring.
          Open

                  case EventTypes.RemoveModel:
                      group.drake.on(event, (...args: any[]) => {
                        this.dispatch$.next({ event, name, args });
                      });
                      break;
          Severity: Major
          Found in libs/ng2-dragula/src/components/dragula.service.ts and 6 other locations - About 1 hr to fix
          libs/ng2-dragula/src/components/dragula.service.ts on lines 314..318
          libs/ng2-dragula/src/components/dragula.service.ts on lines 319..323
          libs/ng2-dragula/src/components/dragula.service.ts on lines 325..329
          libs/ng2-dragula/src/components/dragula.service.ts on lines 335..339
          libs/ng2-dragula/src/components/dragula.service.ts on lines 341..345
          libs/ng2-dragula/src/components/dragula.service.ts on lines 346..350

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

          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 7 locations. Consider refactoring.
          Open

                  case EventTypes.DragEnd:
                    group.drake.on(event, (...args: any[]) => {
                      this.dispatch$.next({ event, name, args });
                    });
                    break;
          Severity: Major
          Found in libs/ng2-dragula/src/components/dragula.service.ts and 6 other locations - About 1 hr to fix
          libs/ng2-dragula/src/components/dragula.service.ts on lines 314..318
          libs/ng2-dragula/src/components/dragula.service.ts on lines 319..323
          libs/ng2-dragula/src/components/dragula.service.ts on lines 335..339
          libs/ng2-dragula/src/components/dragula.service.ts on lines 341..345
          libs/ng2-dragula/src/components/dragula.service.ts on lines 346..350
          libs/ng2-dragula/src/components/dragula.service.ts on lines 352..356

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

          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 7 locations. Consider refactoring.
          Open

                  case EventTypes.DropModel:
                    group.drake.on(event, (...args: any[]) => {
                      this.dispatch$.next({ event, name, args });
                    });
                    break;
          Severity: Major
          Found in libs/ng2-dragula/src/components/dragula.service.ts and 6 other locations - About 1 hr to fix
          libs/ng2-dragula/src/components/dragula.service.ts on lines 314..318
          libs/ng2-dragula/src/components/dragula.service.ts on lines 319..323
          libs/ng2-dragula/src/components/dragula.service.ts on lines 325..329
          libs/ng2-dragula/src/components/dragula.service.ts on lines 335..339
          libs/ng2-dragula/src/components/dragula.service.ts on lines 341..345
          libs/ng2-dragula/src/components/dragula.service.ts on lines 352..356

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

          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 7 locations. Consider refactoring.
          Open

                  case EventTypes.Cloned:
                    group.drake.on(event, (...args: any[]) => {
                      this.dispatch$.next({ event, name, args });
                    });
                    break;
          Severity: Major
          Found in libs/ng2-dragula/src/components/dragula.service.ts and 6 other locations - About 1 hr to fix
          libs/ng2-dragula/src/components/dragula.service.ts on lines 314..318
          libs/ng2-dragula/src/components/dragula.service.ts on lines 319..323
          libs/ng2-dragula/src/components/dragula.service.ts on lines 325..329
          libs/ng2-dragula/src/components/dragula.service.ts on lines 335..339
          libs/ng2-dragula/src/components/dragula.service.ts on lines 346..350
          libs/ng2-dragula/src/components/dragula.service.ts on lines 352..356

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

          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 7 locations. Consider refactoring.
          Open

                  case EventTypes.Out:
                    group.drake.on(event, (...args: any[]) => {
                      this.dispatch$.next({ event, name, args });
                    });
                    break;
          Severity: Major
          Found in libs/ng2-dragula/src/components/dragula.service.ts and 6 other locations - About 1 hr to fix
          libs/ng2-dragula/src/components/dragula.service.ts on lines 314..318
          libs/ng2-dragula/src/components/dragula.service.ts on lines 319..323
          libs/ng2-dragula/src/components/dragula.service.ts on lines 325..329
          libs/ng2-dragula/src/components/dragula.service.ts on lines 341..345
          libs/ng2-dragula/src/components/dragula.service.ts on lines 346..350
          libs/ng2-dragula/src/components/dragula.service.ts on lines 352..356

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

          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