bcongdon/WunderSchedule

View on GitHub
utils/parseTaskTemplate.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function parseContentString has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

exports.parseContentString = function(str) {
  'use strict';
  var template_dict = {};
  var lines = str.split(/[\n\r;]+/);
  var i = 0, dateStr = '';
Severity: Minor
Found in utils/parseTaskTemplate.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 updateTemplateWithRepeat has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.updateTemplateWithRepeat = function (task_template){
  'use strict';
  var rep_str = task_template.repeat_every;
  if (rep_str) {
    var old_due_time = task_template.due_date;
Severity: Minor
Found in utils/parseTaskTemplate.js - About 1 hr to fix

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

    exports.parseContentString = function(str) {
      'use strict';
      var template_dict = {};
      var lines = str.split(/[\n\r;]+/);
      var i = 0, dateStr = '';
    Severity: Minor
    Found in utils/parseTaskTemplate.js - About 1 hr to fix

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

      exports.updateTemplateWithRepeat = function (task_template){
        'use strict';
        var rep_str = task_template.repeat_every;
        if (rep_str) {
          var old_due_time = task_template.due_date;
      Severity: Minor
      Found in utils/parseTaskTemplate.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 extractTemplateTasks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.extractTemplateTasks = function (list_id, cb) {
        'use strict';
        note.getNoteList(list_id, function (res_body) {
          var templates = [], new_template = '';
          var i = 0;
      Severity: Minor
      Found in utils/parseTaskTemplate.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

      Function templateToNoteString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.templateToNoteString = function (template) {
        var contentStr = '';
        if (template.repeat_every) contentStr += 'repeat-every: ' + template.repeat_every + '\n';
        if (template.starred) contentStr += 'starred\n';
        if (template.list) contentStr += 'list: ' + template.list + '\n';
      Severity: Minor
      Found in utils/parseTaskTemplate.js - About 35 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