Nhogs/popoto

View on GitHub
src/query/query.js

Summary

Maintainability
F
1 wk
Test Coverage
A
100%

File query.js has 472 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import provider from "../provider/provider";
import dataModel from "../datamodel/dataModel";

var query = {};

Severity: Minor
Found in src/query/query.js - About 7 hrs to fix

    Function generateNodeValueConstraints has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    query.generateNodeValueConstraints = function (node, useCustomConstraints) {
        if (useCustomConstraints && provider.node.getGenerateNodeValueConstraints(node) !== undefined) {
            return provider.node.getGenerateNodeValueConstraints(node)(node);
        } else {
            var parameters = {}, whereElements = [];
    Severity: Minor
    Found in src/query/query.js - About 4 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 generateResultQuery has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    query.generateResultQuery = function (isGraph) {
        var rootNode = dataModel.getRootNode();
        var negativeElements = query.generateNegativeQueryElements();
        var queryElements = query.generateQueryElements(rootNode, rootNode, query.getRelevantLinks(rootNode, rootNode, dataModel.links), true, true);
        var queryMatchElements = queryElements.matchElements,
    Severity: Major
    Found in src/query/query.js - About 3 hrs to fix

      Function generateResultQuery has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      query.generateResultQuery = function (isGraph) {
          var rootNode = dataModel.getRootNode();
          var negativeElements = query.generateNegativeQueryElements();
          var queryElements = query.generateQueryElements(rootNode, rootNode, query.getRelevantLinks(rootNode, rootNode, dataModel.links), true, true);
          var queryMatchElements = queryElements.matchElements,
      Severity: Minor
      Found in src/query/query.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 generateQueryElements has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      query.generateQueryElements = function (rootNode, selectedNode, links, isConstraintNeeded, useCustomConstraints) {
          var matchElements = [];
          var whereElements = [];
          var relationElements = [];
          var returnElements = [];
      Severity: Major
      Found in src/query/query.js - About 2 hrs to fix

        Function generateNegativeQueryElements has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        query.generateNegativeQueryElements = function () {
            var whereElements = [];
            var parameters = {};
        
            var negativeNodes = dataModel.nodes.filter(function (n) {
        Severity: Major
        Found in src/query/query.js - About 2 hrs to fix

          Function generateNodeValueQuery has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          query.generateNodeValueQuery = function (targetNode) {
              var negativeElements = query.generateNegativeQueryElements();
              var rootNode = dataModel.getRootNode();
              var queryElements = query.generateQueryElements(rootNode, targetNode, query.getRelevantLinks(rootNode, targetNode, dataModel.links), true, false);
              var queryMatchElements = queryElements.matchElements,
          Severity: Minor
          Found in src/query/query.js - About 1 hr to fix

            Function generateNodeValueConstraints has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            query.generateNodeValueConstraints = function (node, useCustomConstraints) {
                if (useCustomConstraints && provider.node.getGenerateNodeValueConstraints(node) !== undefined) {
                    return provider.node.getGenerateNodeValueConstraints(node)(node);
                } else {
                    var parameters = {}, whereElements = [];
            Severity: Minor
            Found in src/query/query.js - About 1 hr to fix

              Function generateNodeValueQuery has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              query.generateNodeValueQuery = function (targetNode) {
                  var negativeElements = query.generateNegativeQueryElements();
                  var rootNode = dataModel.getRootNode();
                  var queryElements = query.generateQueryElements(rootNode, targetNode, query.getRelevantLinks(rootNode, targetNode, dataModel.links), true, false);
                  var queryMatchElements = queryElements.matchElements,
              Severity: Minor
              Found in src/query/query.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 getRelevantLinks has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              query.getRelevantLinks = function (rootNode, targetNode, initialLinks) {
                  var links = initialLinks.slice();
                  var finalLinks = [];
              
                  // Filter all links to keep only those containing a value or being the selected node.
              Severity: Minor
              Found in src/query/query.js - About 1 hr to fix

                Function generateNodeCountQuery has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                query.generateNodeCountQuery = function (countedNode) {
                    var negativeElements = query.generateNegativeQueryElements();
                    var queryElements = query.generateQueryElements(dataModel.getRootNode(), countedNode, query.getRelevantLinks(dataModel.getRootNode(), countedNode, dataModel.links), true, true);
                    var queryMatchElements = queryElements.matchElements,
                        queryWhereElements = queryElements.whereElements.concat(negativeElements.whereElements),
                Severity: Minor
                Found in src/query/query.js - About 1 hr to fix

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

                  query.generateNodeRelationQuery = function (targetNode) {
                  
                      var linksToRoot = query.getLinksToRoot(targetNode, dataModel.links);
                  
                      var queryElements = query.generateQueryElements(dataModel.getRootNode(), targetNode, linksToRoot, false, false);
                  Severity: Minor
                  Found in src/query/query.js - About 1 hr to fix

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

                    query.getLinksToRoot = function (node, links) {
                        var pathLinks = [];
                        var targetNode = node;
                    
                        while (targetNode !== dataModel.getRootNode()) {
                    Severity: Minor
                    Found in src/query/query.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

                    Avoid deeply nested control flow statements.
                    Open

                                                for (var pid = 0; pid < targetNode.value.length; pid++) {
                                                    parameters[paramName + "_" + pid] = targetNode.value[pid].attributes[constraintAttr];
                                                }
                    Severity: Major
                    Found in src/query/query.js - About 45 mins to fix

                      Function generateQueryElements has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      query.generateQueryElements = function (rootNode, selectedNode, links, isConstraintNeeded, useCustomConstraints) {
                      Severity: Minor
                      Found in src/query/query.js - About 35 mins to fix

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

                        query.generateQueryElements = function (rootNode, selectedNode, links, isConstraintNeeded, useCustomConstraints) {
                            var matchElements = [];
                            var whereElements = [];
                            var relationElements = [];
                            var returnElements = [];
                        Severity: Minor
                        Found in src/query/query.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

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

                        query.generateTaxonomyCountQuery = function (label) {
                            var constraintAttr = provider.node.getConstraintAttribute(label);
                        
                            var whereElements = [];
                        
                        
                        Severity: Minor
                        Found in src/query/query.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 generateNodeCountQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        query.generateNodeCountQuery = function (countedNode) {
                            var negativeElements = query.generateNegativeQueryElements();
                            var queryElements = query.generateQueryElements(dataModel.getRootNode(), countedNode, query.getRelevantLinks(dataModel.getRootNode(), countedNode, dataModel.links), true, true);
                            var queryMatchElements = queryElements.matchElements,
                                queryWhereElements = queryElements.whereElements.concat(negativeElements.whereElements),
                        Severity: Minor
                        Found in src/query/query.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

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

                            if (isConstraintNeeded || rootNode.immutable) {
                                var rootValueConstraints = query.generateNodeValueConstraints(rootNode, useCustomConstraints);
                                whereElements = whereElements.concat(rootValueConstraints.whereElements);
                                for (var param in rootValueConstraints.parameters) {
                                    if (rootValueConstraints.parameters.hasOwnProperty(param)) {
                        Severity: Major
                        Found in src/query/query.js and 1 other location - About 2 hrs to fix
                        src/query/query.js on lines 238..246

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

                        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

                                if (targetNode !== selectedNode && (isConstraintNeeded || targetNode.immutable)) {
                                    var nodeValueConstraints = query.generateNodeValueConstraints(targetNode, useCustomConstraints);
                                    whereElements = whereElements.concat(nodeValueConstraints.whereElements);
                                    for (var param in nodeValueConstraints.parameters) {
                                        if (nodeValueConstraints.parameters.hasOwnProperty(param)) {
                        Severity: Major
                        Found in src/query/query.js and 1 other location - About 2 hrs to fix
                        src/query/query.js on lines 179..187

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

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

                            var queryStatement = "MATCH " + queryMatchElements.join(", ") + ((queryWhereElements.length > 0) ? " WHERE " + queryWhereElements.join(" AND ") : "") + " RETURN DISTINCT " + queryReturnElements.join(", ") + " " + queryEndElements.join(" ");
                        Severity: Major
                        Found in src/query/query.js and 2 other locations - About 2 hrs to fix
                        src/query/query.js on lines 614..614
                        src/query/query.js on lines 658..658

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

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

                            var queryStatement = "MATCH " + queryMatchElements.join(", ") + ((queryWhereElements.length > 0) ? " WHERE " + queryWhereElements.join(" AND ") : "") + " RETURN " + queryReturnElements.join(", ") + " " + queryEndElements.join(" ");
                        Severity: Major
                        Found in src/query/query.js and 2 other locations - About 2 hrs to fix
                        src/query/query.js on lines 497..497
                        src/query/query.js on lines 614..614

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

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

                            var queryStatement = "MATCH " + queryMatchElements.join(", ") + ((queryWhereElements.length > 0) ? " WHERE " + queryWhereElements.join(" AND ") : "") + " RETURN " + queryReturnElements.join(", ") + " " + queryEndElements.join(" ");
                        Severity: Major
                        Found in src/query/query.js and 2 other locations - About 2 hrs to fix
                        src/query/query.js on lines 497..497
                        src/query/query.js on lines 658..658

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

                        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

                            if (rootConstraintAttr === query.NEO4J_INTERNAL_ID) {
                                queryReturnElements.push("count(DISTINCT ID(" + rootNode.internalLabel + ")) AS count");
                            } else {
                                queryReturnElements.push("count(DISTINCT " + rootNode.internalLabel + "." + rootConstraintAttr + ") AS count");
                            }
                        Severity: Major
                        Found in src/query/query.js and 1 other location - About 1 hr to fix
                        src/query/query.js on lines 536..540

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

                        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

                            if (countAttr === query.NEO4J_INTERNAL_ID) {
                                queryReturnElements.push("count(DISTINCT ID(" + countedNode.internalLabel + ")) as count");
                            } else {
                                queryReturnElements.push("count(DISTINCT " + countedNode.internalLabel + "." + countAttr + ") as count");
                            }
                        Severity: Major
                        Found in src/query/query.js and 1 other location - About 1 hr to fix
                        src/query/query.js on lines 602..606

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

                        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

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

                            for (var prop in negativeElements.parameters) {
                                if (negativeElements.parameters.hasOwnProperty(prop)) {
                                    queryParameters[prop] = negativeElements.parameters[prop];
                                }
                            }
                        Severity: Major
                        Found in src/query/query.js and 1 other location - About 1 hr to fix
                        src/query/query.js on lines 425..429

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

                        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

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

                            for (var prop in negativeElements.parameters) {
                                if (negativeElements.parameters.hasOwnProperty(prop)) {
                                    queryParameters[prop] = negativeElements.parameters[prop];
                                }
                            }
                        Severity: Major
                        Found in src/query/query.js and 1 other location - About 1 hr to fix
                        src/query/query.js on lines 573..577

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

                        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

                                    if (constraintAttr === query.NEO4J_INTERNAL_ID) {
                                        paramName = node.internalLabel + "_internalID";
                                    } else {
                                        paramName = node.internalLabel + "_" + constraintAttr;
                                    }
                        Severity: Minor
                        Found in src/query/query.js and 1 other location - About 55 mins to fix
                        src/cypherviewer/cypherviewer.js on lines 173..177

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

                        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

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

                            var queryMatchElements = queryElements.matchElements,
                                queryWhereElements = queryElements.whereElements.concat(negativeElements.whereElements),
                                queryReturnElements = [],
                                queryEndElements = [],
                                queryParameters = queryElements.parameters;
                        Severity: Minor
                        Found in src/query/query.js and 1 other location - About 55 mins to fix
                        src/query/query.js on lines 522..526

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

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

                            var queryStructure = provider.node.filterNodeCountQuery(countedNode, {
                                statement: queryStatement,
                                matchElements: queryMatchElements,
                                whereElements: queryWhereElements,
                                returnElements: queryReturnElements,
                        Severity: Major
                        Found in src/query/query.js and 2 other locations - About 55 mins to fix
                        src/query/query.js on lines 617..624
                        src/query/query.js on lines 660..667

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

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

                            var queryStructure = provider.node.filterNodeValueQuery(targetNode, {
                                statement: queryStatement,
                                matchElements: queryMatchElements,
                                whereElements: queryWhereElements,
                                returnElements: queryReturnElements,
                        Severity: Major
                        Found in src/query/query.js and 2 other locations - About 55 mins to fix
                        src/query/query.js on lines 545..552
                        src/query/query.js on lines 660..667

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

                        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

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

                            var queryMatchElements = queryElements.matchElements,
                                queryWhereElements = queryElements.whereElements.concat(negativeElements.whereElements),
                                queryReturnElements = [],
                                queryEndElements = [],
                                queryParameters = queryElements.parameters;
                        Severity: Minor
                        Found in src/query/query.js and 1 other location - About 55 mins to fix
                        src/query/query.js on lines 567..571

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

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

                            var queryStructure = provider.node.filterNodeRelationQuery(targetNode, {
                                statement: queryStatement,
                                matchElements: queryMatchElements,
                                whereElements: queryWhereElements,
                                returnElements: queryReturnElements,
                        Severity: Major
                        Found in src/query/query.js and 2 other locations - About 55 mins to fix
                        src/query/query.js on lines 545..552
                        src/query/query.js on lines 617..624

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

                        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

                                if (!useCustomConstraints || provider.node.getGenerateNodeValueConstraints(targetNode) === undefined) {
                                    targetLabelStatement = ":`" + targetNode.label + "`";
                                }
                        Severity: Minor
                        Found in src/query/query.js and 1 other location - About 40 mins to fix
                        src/query/query.js on lines 226..228

                        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

                                if (!useCustomConstraints || provider.node.getGenerateNodeValueConstraints(sourceNode) === undefined) {
                                    sourceLabelStatement = ":`" + sourceNode.label + "`";
                                }
                        Severity: Minor
                        Found in src/query/query.js and 1 other location - About 40 mins to fix
                        src/query/query.js on lines 232..234

                        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

                                predefinedConstraints.forEach(function (predefinedConstraint) {
                                    whereElements.push(predefinedConstraint.replace(new RegExp("\\$identifier", 'g'), targetNode.internalLabel));
                                });
                        Severity: Minor
                        Found in src/query/query.js and 1 other location - About 35 mins to fix
                        src/query/query.js on lines 172..174

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

                        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

                            rootPredefinedConstraints.forEach(function (predefinedConstraint) {
                                whereElements.push(predefinedConstraint.replace(new RegExp("\\$identifier", 'g'), rootNode.internalLabel));
                            });
                        Severity: Minor
                        Found in src/query/query.js and 1 other location - About 35 mins to fix
                        src/query/query.js on lines 216..218

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

                        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

                                            if (targetNode.isParentRelReverse !== true && query.USE_RELATION_DIRECTION === true) {
                                                statement += "->";
                                            } else {
                                                statement += "-";
                                            }
                        Severity: Minor
                        Found in src/query/query.js and 1 other location - About 30 mins to fix
                        src/query/query.js on lines 96..100

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

                        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

                                            if (targetNode.isParentRelReverse === true && query.USE_RELATION_DIRECTION === true) {
                                                statement += "<-";
                                            } else {
                                                statement += "-";
                                            }
                        Severity: Minor
                        Found in src/query/query.js and 1 other location - About 30 mins to fix
                        src/query/query.js on lines 104..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 45.

                        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

                        There are no issues that match your filters.

                        Category
                        Status