Nhogs/popoto

View on GitHub

Showing 303 of 303 total issues

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

                } else {
                    elmts.push(
                        {
                            id: id++,
                            type: targetNode.type,
Severity: Major
Found in src/queryviewer/queryviewer.js and 1 other location - About 1 hr to fix
src/queryviewer/queryviewer.js on lines 214..223

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

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

node.expandNode = function (clickedNode) {

    graph.notifyListeners(graph.Events.GRAPH_NODE_VALUE_EXPAND, [clickedNode]);

    // Get subset of node corresponding to the current node page and page size
Severity: Minor
Found in src/graph/node/node.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 render has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      textRenderer.render = function (nodeSelection) {
      
          var backgroundRectSelection = nodeSelection
              .append("rect")
              .attr("fill", function (node) {
      Severity: Minor
      Found in src/graph/node/textRenderer.js - About 1 hr to fix

        Function chooseNodeClick has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        node.chooseNodeClick = function (clickedNode) {
            logger.debug("chooseNodeClick (" + clickedNode.label + ") with waiting state set to " + node.chooseWaiting);
            if (!node.chooseWaiting && !clickedNode.immutable && !(clickedNode.count === 0)) {
        
                // Collapse all expanded nodes first
        Severity: Minor
        Found in src/graph/node/node.js - About 1 hr to fix

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

          node.removeExpandedValue = function (attribute, value) {
              var isAnyChangeDone = false;
          
              // For each expanded nodes in reverse order as some values can be removed
              for (var i = dataModel.nodes.length - 1; i >= 0; i--) {
          Severity: Minor
          Found in src/graph/node/node.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 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

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

              gMiddlegroundSymbolNodes.append("circle").attr("r", function (n) {
                  return provider.node.getSize(n);
              })
                  .attr("class", function (n) {
                      return provider.node.getCSSClass(n, "symbol-background-circle")
          Severity: Major
          Found in src/graph/node/node.js and 1 other location - About 1 hr to fix
          src/graph/node/node.js on lines 712..717

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

          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

              gMiddlegroundImageNodes.append("circle").attr("r", function (n) {
                  return provider.node.getSize(n);
              })
                  .attr("class", function (n) {
                      return provider.node.getCSSClass(n, "image-background-circle")
          Severity: Major
          Found in src/graph/node/node.js and 1 other location - About 1 hr to fix
          src/graph/node/node.js on lines 739..744

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

          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 updateAutoLoadValues has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          node.updateAutoLoadValues = function () {
              var statements = [];
          
              var nodesToLoadData = node.getAutoLoadValueNodes();
          
          
          Severity: Minor
          Found in src/graph/node/node.js - About 1 hr to fix

            Function updateElements has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            node.updateElements = function () {
                var toUpdateElem = graph.svg.select("#" + node.gID).selectAll(".ppt-gnode");
            
                toUpdateElem.attr("id", function (d) {
                    return "popoto-gnode_" + d.id;
            Severity: Minor
            Found in src/graph/node/node.js - About 1 hr to fix

              Function loadSchemaRelation has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              graph.loadSchemaRelation = function (relationSchema, parentNode, linkIndex, parentLinkTotalCount) {
                  var targetNodeSchema = relationSchema.target;
                  var target = graph.loadSchemaNode(targetNodeSchema, parentNode, linkIndex, parentLinkTotalCount, relationSchema.label, (relationSchema.hasOwnProperty("isReverse") && relationSchema.isReverse === true));
              
                  var newLink = {
              Severity: Minor
              Found in src/graph/graph.js - About 1 hr to fix

                Function toggleFullScreen has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                tools.toggleFullScreen = function () {
                
                    var elem = document.getElementById(graph.containerId);
                
                    if (!document.fullscreenElement &&    // alternative standard method
                Severity: Minor
                Found in src/tools/tools.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 start has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                export function start(startParam) {
                    logger.info("Popoto " + version + " start on " + startParam);
                
                    graph.mainLabel = startParam;
                
                
                Severity: Minor
                Found in src/popoto.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 updateCount has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                node.updateCount = function () {
                    var statements = [];
                
                    var countedNodes = dataModel.nodes
                        .filter(function (d) {
                Severity: Minor
                Found in src/graph/node/node.js - About 1 hr to fix

                  Function generateData has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  queryviewer.generateData = function (links, nodes) {
                      var elmts = [], options = [], id = 0;
                  
                      // Add a span for each link and its target node
                      links.forEach(function (l) {
                  Severity: Minor
                  Found in src/queryviewer/queryviewer.js - About 1 hr to fix

                    Function addSchema has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    graph.addSchema = function (graphSchema) {
                        if (dataModel.nodes.length > 0) {
                            logger.warn("graph.addSchema is called but the graph is not empty.");
                        }
                    
                    
                    Severity: Minor
                    Found in src/graph/graph.js - About 1 hr to fix

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

                          if (tools.TOGGLE_FULL_SCREEN) {
                              toolbar.append("span")
                                  .attr("id", "popoto-fullscreen-menu")
                                  .attr("class", "ppt-icon ppt-menu fullscreen")
                                  .attr("title", toolbar.TOOL_FULL_SCREEN)
                      Severity: Major
                      Found in src/toolbar/toolbar.js and 3 other locations - About 1 hr to fix
                      src/toolbar/toolbar.js on lines 40..46
                      src/toolbar/toolbar.js on lines 48..54
                      src/toolbar/toolbar.js on lines 74..80

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

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

                          if (tools.TOGGLE_FIT_TEXT) {
                              toolbar.append("span")
                                  .attr("id", "popoto-fit-text-menu")
                                  .attr("class", "ppt-icon ppt-menu fit-text")
                                  .attr("title", toolbar.TOOL_FIT_TEXT)
                      Severity: Major
                      Found in src/toolbar/toolbar.js and 3 other locations - About 1 hr to fix
                      src/toolbar/toolbar.js on lines 40..46
                      src/toolbar/toolbar.js on lines 48..54
                      src/toolbar/toolbar.js on lines 56..62

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language