schahriar/supertask

View on GitHub

Showing 9 of 15 total issues

Function ST__CREATE_CONTEXT_P has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function ST__CREATE_CONTEXT_P(context, type) {
    if (type === ST_NONE) return context;
    switch(type) {
        case ST_RESTRICTED:
            // Allow stream module
Severity: Minor
Found in lib/ContextPermissions.js - About 7 hrs 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 _next has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    _next() {
        // Allow _next_ to be called
        this._busy_ = false;
        
        /* At this point the source is fully compiled
Severity: Minor
Found in lib/SuperTask.js - About 2 hrs 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 apply has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    apply(name, context, args, callback) {
        
        // Check for mapped task
        if (!this.map.has(name)) {
            callback(new Error('Task not found!'));
Severity: Minor
Found in interface.js - About 2 hrs 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 apply has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    apply(name, context, args, callback) {
        
        // Check for mapped task
        if (!this.map.has(name)) {
            callback(new Error('Task not found!'));
Severity: Minor
Found in interface.js - About 1 hr to fix

    Function ST__CREATE_CONTEXT_P has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function ST__CREATE_CONTEXT_P(context, type) {
        if (type === ST_NONE) return context;
        switch(type) {
            case ST_RESTRICTED:
                // Allow stream module
    Severity: Minor
    Found in lib/ContextPermissions.js - About 1 hr to fix

      Function _next has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _next() {
              // Allow _next_ to be called
              this._busy_ = false;
              
              /* At this point the source is fully compiled
      Severity: Minor
      Found in lib/SuperTask.js - About 1 hr to fix

        Function _compile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            _compile(task, context) {        
                // Check if script is not compiled
                if (typeof task.func === 'string') {
                    // Compile script using VM
                    task.func = new vm.Script(task.func);
        Severity: Minor
        Found in lib/SuperTask.js - About 55 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

        Avoid too many return statements within this function.
        Open

                        else return callback(new Error("Unknown error occurred. Failed to compile and execution was halted."));
        Severity: Major
        Found in interface.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return callback(e);
          Severity: Major
          Found in interface.js - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language