egslava/freemind-todo

View on GitHub

Showing 4 of 11 total issues

Function getPath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function getPath(node, id){
    if (
        node.hasOwnProperty('$')
        && node['$'].hasOwnProperty('ID')
        && node['$']['ID'] === id) return [node];
Severity: Minor
Found in src/node.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 checkTasksPrompt has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function checkTasksPrompt(message, tasks, tree, rows, callback) {
Severity: Minor
Found in src/ui.js - About 35 mins to fix

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

    function removeCommonPrefixes(lines, symbol){
        const result = lines.slice(); //sort().slice(); #
        for (let i = 0; i < lines.length; i++){
            for (let j = i+1; j < lines.length; j++){
                const prefix = _commonPrefixLength(lines[i], lines[j]);
    Severity: Minor
    Found in src/ui.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

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

    function _commonPrefixLength(str1, str2){
        let i = 0;
        for(i = 0; i < Math.min(str1.length, str2.length); i++){
            if (str1[i] != str2[i]) break;
        }
    Severity: Minor
    Found in src/ui.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