src/workspace-element.js

Summary

Maintainability
D
2 days
Test Coverage

File workspace-element.js has 420 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const { ipcRenderer } = require('electron');
const path = require('path');
const fs = require('fs-plus');
Severity: Minor
Found in src/workspace-element.js - About 6 hrs to fix

    WorkspaceElement has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class WorkspaceElement extends HTMLElement {
      connectedCallback() {
        this.focus();
        this.htmlElement = document.querySelector('html');
        this.htmlElement.addEventListener('mouseleave', this.handleCenterLeave);
    Severity: Minor
    Found in src/workspace-element.js - About 4 hrs to fix

      Function initialize has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        initialize(model, { config, project, styleManager, viewRegistry }) {
          this.handleCenterEnter = this.handleCenterEnter.bind(this);
          this.handleCenterLeave = this.handleCenterLeave.bind(this);
          this.handleEdgesMouseMove = _.throttle(
            this.handleEdgesMouseMove.bind(this),
      Severity: Major
      Found in src/workspace-element.js - About 3 hrs to fix

        Function nearestVisiblePaneInDirection has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          nearestVisiblePaneInDirection(direction, pane) {
            const distance = function(pointA, pointB) {
              const x = pointB.x - pointA.x;
              const y = pointB.y - pointA.y;
              return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
        Severity: Minor
        Found in src/workspace-element.js - About 1 hr to fix

          Function initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            initialize(model, { config, project, styleManager, viewRegistry }) {
              this.handleCenterEnter = this.handleCenterEnter.bind(this);
              this.handleCenterLeave = this.handleCenterLeave.bind(this);
              this.handleEdgesMouseMove = _.throttle(
                this.handleEdgesMouseMove.bind(this),
          Severity: Minor
          Found in src/workspace-element.js - About 45 mins 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 runPackageSpecs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            runPackageSpecs(options = {}) {
              const activePaneItem = this.model.getActivePaneItem();
              const activePath =
                activePaneItem && typeof activePaneItem.getPath === 'function'
                  ? activePaneItem.getPath()
          Severity: Minor
          Found in src/workspace-element.js - About 25 mins 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

          There are no issues that match your filters.

          Category
          Status