Showing 11 of 13 total issues
Function handleTemplates
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function handleTemplates(templates){
var i = 0;
var now = new Date();
for(i = 0; i < templates.length; i++){
- Read upRead up
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 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 = '';
- Read upRead up
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;
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 = '';
Function createTask
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.createTask = function (list_id, title, due_date, starred, reminder) {
'use strict';
due_date = due_date || '';
starred = starred || false;
var task_dict = {
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;
- Read upRead up
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;
- Read upRead up
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 deeply nested control flow statements. Open
if(template) {
parse.pushTemplateUpdate(template);
} else{
// Called when repetition could not be parsed
task.deleteTask(curr.task_id);
Function createTask
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.createTask = function (list_id, title, due_date, starred, reminder) {
Function getListID
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.getListID = function(list_name, cb){
api('/lists',function(err, res, body){
if(err){
log.error('Error getting lists!');
log.error(err);
- Read upRead up
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';
- Read upRead up
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"