icodeforlove/task.js

View on GitHub

Showing 8 of 17 total issues

File WorkerManager.js has 329 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Transferables {
    constructor (transferables) {
        this.transferables = transferables.map(transferable => {
            if (!(transferable instanceof ArrayBuffer) && transferable && transferable.buffer instanceof ArrayBuffer) {
                return transferable.buffer;
Severity: Minor
Found in src/WorkerManager.js - About 3 hrs to fix

    Function constructor has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        constructor ($config, WorkerProxies) {
            $config = $config || {};
    
            this.id = ++WorkerManager.managerCount;
    
    
    Severity: Major
    Found in src/WorkerManager.js - About 2 hrs to fix

      Function _createWorker has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _createWorker () {
              let workerId = ++this._totalWorkersCreated;
      
              let worker = new this._WorkerProxy({
                  debug: this._debug,
      Severity: Major
      Found in src/WorkerManager.js - About 2 hrs to fix

        Function _run has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _run (task) {
                if (this._terminated) {
                    return;
                }
        
        
        Severity: Minor
        Found in src/WorkerManager.js - About 1 hr to fix

          Function _run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              _run (task) {
                  if (this._terminated) {
                      return;
                  }
          
          
          Severity: Minor
          Found in src/WorkerManager.js - 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 constructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              constructor ($config, WorkerProxies) {
                  $config = $config || {};
          
                  this.id = ++WorkerManager.managerCount;
          
          
          Severity: Minor
          Found in src/WorkerManager.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 _createWorker has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              _createWorker () {
                  let workerId = ++this._totalWorkersCreated;
          
                  let worker = new this._WorkerProxy({
                      debug: this._debug,
          Severity: Minor
          Found in src/WorkerManager.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

          Consider simplifying this complex logical expression.
          Open

                  if (this._globalsInitializationFunction || this._globals || this._requires) {
                      if (this._debug) {
                          this._log({
                              action: 'run_global_initialize',
                              message: `running global initialization code`
          Severity: Major
          Found in src/WorkerManager.js - About 40 mins to fix
            Severity
            Category
            Status
            Source
            Language