AndrewRevinsky/crunchtask.js

View on GitHub

Showing 21 of 21 total issues

Function encapsulateRunInstance has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

function encapsulateRunInstance(instanceApi, taskEvents, resolveReject, promise) {

  var ctx = this, // jshint ignore:line
    thisTask = ctx.task,
    parentTask = ctx.parentTask,
Severity: Minor
Found in lib/ctRunEncapsulateInst.js - About 6 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 encapsulateRunInstance has 155 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function encapsulateRunInstance(instanceApi, taskEvents, resolveReject, promise) {

  var ctx = this, // jshint ignore:line
    thisTask = ctx.task,
    parentTask = ctx.parentTask,
Severity: Major
Found in lib/ctRunEncapsulateInst.js - About 6 hrs to fix

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

    setupFin: function (_finallyFn) {
      if (config.trace) {
        console.log('setupFin', new Date() - 0);
      }
      if (SETTLED_STATES[ctx.state]) {
Severity: Major
Found in lib/ctRunEncapsulateInst.js and 1 other location - About 3 hrs to fix
lib/ctRunEncapsulateInst.js on lines 42..56

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

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

    setupInit: function (_initFn) {
      if (config.trace) {
        console.log('setupInit', new Date() - 0);
      }

Severity: Major
Found in lib/ctRunEncapsulateInst.js and 1 other location - About 3 hrs to fix
lib/ctRunEncapsulateInst.js on lines 97..108

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

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

    reject   : function () {

      if (SETTLED_STATES[ctx.state]) {
        return;
      }
Severity: Major
Found in lib/ctRunEncapsulateInst.js and 1 other location - About 2 hrs to fix
lib/ctRunEncapsulateInst.js on lines 129..140

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

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

    resolve  : function () {
      if (SETTLED_STATES[ctx.state]) {
        return;
      }
      var args0 = __slice.call(arguments, 0);
Severity: Major
Found in lib/ctRunEncapsulateInst.js and 1 other location - About 2 hrs to fix
lib/ctRunEncapsulateInst.js on lines 144..156

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

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

Function proceedDescriptionFn has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

function proceedDescriptionFn(instanceApi) {

  var ctx = this, // jshint ignore:line
    thisTask = ctx.task,
    descriptionFn = ctx.descriptionFn;
Severity: Minor
Found in lib/ctFnProceedDescription.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 proceedBodyFn has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function proceedBodyFn(instanceApi, isFirstTime) {
  if (config.trace) {

    console.log('inside proceedBodyFn', this.id, new Date() - 0); // jshint ignore:line
    console.log('isFirstTime', isFirstTime);
Severity: Major
Found in lib/ctFnProceedBody.js - About 2 hrs to fix

Function translateRangeSet has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function translateRangeSet(rangeSet) {
  var rangeLength = rangeSet.length,
    last = rangeLength - 1,
    lastIsBool = type.isBoolean(rangeSet[last]),
    step;
Severity: Minor
Found in lib/typeRange.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 proceedDescriptionFn has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function proceedDescriptionFn(instanceApi) {

  var ctx = this, // jshint ignore:line
    thisTask = ctx.task,
    descriptionFn = ctx.descriptionFn;
Severity: Minor
Found in lib/ctFnProceedDescription.js - About 1 hr to fix

Function parseRangeArgs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function parseRangeArgs(args, preventRecursion) {
  var result = [],
    current = [],
    item,
    isArrayFlag;
Severity: Minor
Found in lib/typeRange.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 canAdvance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

Range.prototype.canAdvance = function canAdvance(justCheck) {
  var currentR = 0,
    ranges = this.data,
    maxR = ranges.length,
    range,
Severity: Minor
Found in lib/typeRange.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 staticReduce has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function staticReduce(arr, memo, taskBody, taskTail) {

  return new CrunchTask(function (init, body, fin) {

    var ranges,
Severity: Minor
Found in lib/ctStaticReduce.js - About 1 hr to fix

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

function protoRun(descriptionFn, taskEvents) {
  var thisTask = this; // jshint ignore:line
  var parentTask = globals.staticParentTask;
  globals.staticParentTask = null;

Severity: Minor
Found in lib/ctProtoRun.js - About 1 hr to fix

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

function translateRangeSet(rangeSet) {
  var rangeLength = rangeSet.length,
    last = rangeLength - 1,
    lastIsBool = type.isBoolean(rangeSet[last]),
    step;
Severity: Minor
Found in lib/typeRange.js - About 1 hr to fix

Function staticForEach has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function staticForEach(arr, taskBody, taskTail) {

  return new CrunchTask(function (init, body, fin) {
    var ranges,
      ptr,
Severity: Minor
Found in lib/ctStaticForEach.js - About 1 hr to fix

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

function _trigger(hive, evt /*, args*/) {
  var args1 = __slice.call(arguments, 2);
  if (!hive[evt]) {
    return;
  }
Severity: Minor
Found in lib/events.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

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

var EVENT_NAMES = mirror({
  run     : null,
  done    : null,
  fail    : null,
  abort   : null,
Severity: Minor
Found in lib/constEventNames.js and 1 other location - About 40 mins to fix
lib/constStateNames.js on lines 8..16

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

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

var STATE_NAMES = mirror({
  init    : null,
  error   : null,
  running : null,
  paused  : null,
Severity: Minor
Found in lib/constStateNames.js and 1 other location - About 40 mins to fix
lib/constEventNames.js on lines 8..16

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

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

Function _fnBindAll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function _fnBindAll(ctx, target, source) {
  var method;

  for (var prop in source) {
    //noinspection JSUnfilteredForInLoop
Severity: Minor
Found in lib/bindAll.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

Severity
Category
Status
Source
Language