opf/openproject

View on GitHub
frontend/src/app/features/work-packages/components/wp-table/timeline/cells/wp-timeline-cell-mouse-handler.ts

Summary

Maintainability
D
1 day
Test Coverage

Function registerWorkPackageMouseHandler has 160 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function registerWorkPackageMouseHandler(this:void,
  injector:Injector,
  getRenderInfo:() => RenderInfo,
  workPackageTimeline:WorkPackageTimelineTableController,
  halEditing:HalResourceEditingService,

    Function registerWorkPackageMouseHandler has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    export function registerWorkPackageMouseHandler(this:void,
      injector:Injector,
      getRenderInfo:() => RenderInfo,
      workPackageTimeline:WorkPackageTimelineTableController,
      halEditing:HalResourceEditingService,

    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 registerWorkPackageMouseHandler has 13 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    export function registerWorkPackageMouseHandler(this:void,
      injector:Injector,
      getRenderInfo:() => RenderInfo,
      workPackageTimeline:WorkPackageTimelineTableController,
      halEditing:HalResourceEditingService,

      Function handleMouseMoveOnEmptyCell has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function handleMouseMoveOnEmptyCell(ev:MouseEvent) {
          const wp = renderInfo.workPackage;
      
          if (!renderer.isEmpty(wp)) {
            return;

        Function deactivate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function deactivate(direction:MouseDirection|null, cancelled:boolean) {
            const change = renderInfo.change;
            workPackageTimeline.disableViewParamsCalculation = false;
        
            cell.onmousemove = handleMouseMoveOnEmptyCell;

          There are no issues that match your filters.

          Category
          Status