Nhogs/popoto

View on GitHub

Showing 303 of 303 total issues

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

    gMiddlegroundImageNodes.append("image")
        .attr("class", function (n) {
            return provider.node.getCSSClass(n, "image")
        })
        .attr("width", function (d) {
Severity: Major
Found in src/graph/node/node.js and 1 other location - About 1 day to fix
src/graph/node/node.js on lines 752..768

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

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

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 getProvider has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

    provider.node.getProvider = function (label) {
        if (label === undefined) {
            logger.error("Node label is undefined, no label provider can be found.");
        } else {
            if (provider.node.Provider.hasOwnProperty(label)) {
    Severity: Minor
    Found in src/provider/provider.js - About 7 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

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

                    if (!nodesMap.hasOwnProperty(targetNode.id)) {
                        nodesMap[targetNode.id] = {
                            label: targetNode.label
                        };
                        if (targetNode.hasOwnProperty("isNegative") && targetNode.isNegative === true) {
    Severity: Major
    Found in src/graph/graph.js and 1 other location - About 7 hrs to fix
    src/graph/graph.js on lines 772..785

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

    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 (!nodesMap.hasOwnProperty(sourceNode.id)) {
                        nodesMap[sourceNode.id] = {
                            label: sourceNode.label
                        };
                        if (sourceNode.hasOwnProperty("isNegative") && sourceNode.isNegative === true) {
    Severity: Major
    Found in src/graph/graph.js and 1 other location - About 7 hrs to fix
    src/graph/graph.js on lines 787..800

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

    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 nodeClick has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

    node.nodeClick = function (event) {
        if (!event.defaultPrevented) { // To avoid click on drag end
            var clickedNode = d3.select(this).data()[0]; // Clicked node data
            logger.debug("nodeClick (" + clickedNode.label + ")");
    
    
    Severity: Minor
    Found in src/graph/node/node.js - About 6 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 updateQuery has 157 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    cypherviewer.updateQuery = function () {
    
        // Remove all query span elements
        cypherviewer.querySpanElements = cypherviewer.querySpanElements.data([]);
    
    
    Severity: Major
    Found in src/cypherviewer/cypherviewer.js - About 6 hrs to fix

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

      cypherviewer.generateData = function (links) {
          var elmts = [], id = 0;
          var rootNode = dataModel.getRootNode();
          var relevantLinks = query.getRelevantLinks(rootNode, rootNode, links);
          var negativeLinks = relevantLinks.filter(function (rl) {
      Severity: Major
      Found in src/cypherviewer/cypherviewer.js - About 6 hrs to fix

        File cypherviewer.js has 414 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import * as d3 from "d3";
        import dataModel from "../datamodel/dataModel";
        import queryviewer from "../queryviewer/queryviewer";
        import provider from "../provider/provider";
        import query from "../query/query";
        Severity: Minor
        Found in src/cypherviewer/cypherviewer.js - About 5 hrs to fix

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

              cypherviewer.querySpanElements.filter(function (d) {
                  return d.type === cypherviewer.QueryElementTypes.NODE;
              })
                  .attr("class", function (d) {
                      if (d.node.value !== undefined && d.node.value.length > 0) {
          Severity: Major
          Found in src/cypherviewer/cypherviewer.js and 1 other location - About 5 hrs to fix
          src/cypherviewer/cypherviewer.js on lines 127..139

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

          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

          queryviewer.clickSpan = function () {
              var clickedSpan = d3.select(this).data()[0];
          
              if (!clickedSpan.isLink && clickedSpan.ref) {
                  var nodeElmt = graph.svg.selectAll("#" + graph.node.gID + " > g").filter(function (d) {
          Severity: Major
          Found in src/queryviewer/queryviewer.js and 1 other location - About 5 hrs to fix
          src/queryviewer/queryviewer.js on lines 261..271

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

          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

          queryviewer.rightClickSpan = function () {
              var clickedSpan = d3.select(this).data()[0];
          
              if (!clickedSpan.isLink && clickedSpan.ref) {
                  var nodeElmt = graph.svg.selectAll("#" + graph.node.gID + " > g").filter(function (d) {
          Severity: Major
          Found in src/queryviewer/queryviewer.js and 1 other location - About 5 hrs to fix
          src/queryviewer/queryviewer.js on lines 273..283

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

          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

              cypherviewer.querySpanElements.filter(function (d) {
                  return d.type === cypherviewer.QueryElementTypes.TARGET;
              })
                  .attr("class", function (d) {
                      if (d.node.value !== undefined && d.node.value.length > 0) {
          Severity: Major
          Found in src/cypherviewer/cypherviewer.js and 1 other location - About 5 hrs to fix
          src/cypherviewer/cypherviewer.js on lines 78..90

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

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

          node.updateBackgroundElements = function () {
              var nodeBackgroundElements = graph.svg.select("#" + node.gID).selectAll(".ppt-gnode").selectAll(".ppt-g-node-background");
          
              nodeBackgroundElements.select(".ppt-donut-labels").selectAll("*").remove();
              nodeBackgroundElements.select(".ppt-donut-segments").selectAll("*").remove();
          Severity: Major
          Found in src/graph/node/node.js - About 5 hrs to fix

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

                var n = {
                    "id": dataModel.generateId(),
                    "parent": parentNode,
                    "parentRel": parentRel,
                    "type": (isGroupNode) ? graph.node.NodeTypes.GROUP : graph.node.NodeTypes.CHOOSE,
            Severity: Major
            Found in src/graph/graph.js and 1 other location - About 5 hrs to fix
            src/graph/graph.js on lines 674..687

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

            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

                var n = {
                    "id": dataModel.generateId(),
                    "parent": parentNode,
                    "parentRel": parentRel,
                    "type": (isGroupNode) ? graph.node.NodeTypes.GROUP : graph.node.NodeTypes.CHOOSE,
            Severity: Major
            Found in src/graph/graph.js and 1 other location - About 5 hrs to fix
            src/graph/graph.js on lines 526..539

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

            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

            cypherviewer.clickSpan = function () {
                var clickedSpan = d3.select(this).data()[0];
            
                if (clickedSpan.node) {
                    var nodeElmt = graph.svg.selectAll("#" + graph.node.gID + " > g").filter(function (d) {
            Severity: Major
            Found in src/cypherviewer/cypherviewer.js and 1 other location - About 5 hrs to fix
            src/cypherviewer/cypherviewer.js on lines 502..512

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

            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

            cypherviewer.rightClickSpan = function () {
                var clickedSpan = d3.select(this).data()[0];
            
                if (clickedSpan.node) {
                    var nodeElmt = graph.svg.selectAll("#" + graph.node.gID + " > g").filter(function (d) {
            Severity: Major
            Found in src/cypherviewer/cypherviewer.js and 1 other location - About 5 hrs to fix
            src/cypherviewer/cypherviewer.js on lines 490..500

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

            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 generateData has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

            cypherviewer.generateData = function (links) {
                var elmts = [], id = 0;
                var rootNode = dataModel.getRootNode();
                var relevantLinks = query.getRelevantLinks(rootNode, rootNode, links);
                var negativeLinks = relevantLinks.filter(function (rl) {
            Severity: Minor
            Found in src/cypherviewer/cypherviewer.js - About 5 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 getReturnAttributes has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
            Open

            provider.node.getReturnAttributes = function (label) {
                var nProvider = provider.node.getProvider(label);
                var attributes = {}; // Object is used as a Set to merge possible duplicate in parents
            
                if (nProvider.hasOwnProperty("returnAttributes")) {
            Severity: Minor
            Found in src/provider/provider.js - About 5 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

            Severity
            Category
            Status
            Source
            Language