Nhogs/popoto

View on GitHub

Showing 303 of 303 total issues

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

    if (tools.TOGGLE_TAXONOMY) {
        toolbar.append("span")
            .attr("id", "popoto-taxonomy-menu")
            .attr("class", "ppt-icon ppt-menu taxonomy")
            .attr("title", toolbar.TOOL_TAXONOMY)
Severity: Major
Found in src/toolbar/toolbar.js and 3 other locations - About 1 hr to fix
src/toolbar/toolbar.js on lines 48..54
src/toolbar/toolbar.js on lines 56..62
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.CENTER_GRAPH) {
        toolbar.append("span")
            .attr("id", "popoto-center-menu")
            .attr("class", "ppt-icon ppt-menu center")
            .attr("title", toolbar.TOOL_CENTER)
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 56..62
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

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

link.updateElements = function () {
    var toUpdateElem = graph.svg.select("#" + link.gID).selectAll(".ppt-glink");

    toUpdateElem
        .attr("id", function (d) {
Severity: Minor
Found in src/graph/link/link.js - About 1 hr to fix

    Function addRootNode has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

          var newLink = {
              id: "l" + dataModel.generateId(),
              source: parentNode,
              target: target,
              type: graph.link.LinkTypes.RELATION,
      Severity: Major
      Found in src/graph/graph.js and 1 other location - About 1 hr to fix
      src/graph/graph.js on lines 642..649

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

      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 newLink = {
              id: "l" + dataModel.generateId(),
              source: parentNode,
              target: target,
              type: graph.link.LinkTypes.RELATION,
      Severity: Major
      Found in src/graph/graph.js and 1 other location - About 1 hr to fix
      src/graph/graph.js on lines 459..466

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

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

      taxonomy.createTaxonomyPanel = function () {
          var htmlContainer = d3.select("#" + taxonomy.containerId);
      
          var taxoUL = htmlContainer.append("ul")
              .attr("class", "ppt-taxo-ul");
      Severity: Minor
      Found in src/taxonomy/taxonomy.js - About 1 hr to fix

        Function getSemanticValue has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

                "getSemanticValue": function (node) {
                    var text = "";
                    var displayAttr = provider.node.getDisplayAttribute(node.label);
                    if (node.type === graph.node.NodeTypes.VALUE) {
                        if (displayAttr === query.NEO4J_INTERNAL_ID) {
        Severity: Minor
        Found in src/provider/provider.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 getTextValue has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

                "getTextValue": function (node, maxLength) {
                    var text = "";
                    var displayAttr = provider.node.getDisplayAttribute(node.label);
                    if (node.type === graph.node.NodeTypes.VALUE) {
                        if (displayAttr === query.NEO4J_INTERNAL_ID) {
        Severity: Minor
        Found in src/provider/provider.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 getProperty has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        provider.node.getProperty = function (label, name) {
            var nProvider = provider.node.getProvider(label);
        
            if (!nProvider.hasOwnProperty(name)) {
                var providerIterator = nProvider;
        Severity: Minor
        Found in src/provider/provider.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 checkHtmlComponents has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function checkHtmlComponents() {
            var graphHTMLContainer = d3.select("#" + graph.containerId);
            var taxonomyHTMLContainer = d3.select("#" + taxonomy.containerId);
            var queryHTMLContainer = d3.select("#" + queryviewer.containerId);
            var cypherHTMLContainer = d3.select("#" + cypherviewer.containerId);
        Severity: Minor
        Found in src/popoto.js - About 1 hr to fix

          Function getProvider has 35 lines of code (exceeds 25 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 1 hr to fix

            Function updateCount has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            taxonomy.updateCount = function (taxonomyData) {
                var statements = [];
            
                taxonomyData.forEach(function (taxo) {
                    statements.push(
            Severity: Minor
            Found in src/taxonomy/taxonomy.js - About 1 hr to fix

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

                  if (graphHTMLContainer.empty()) {
                      logger.debug("The page doesn't contain a container with ID = \"" + graph.containerId + "\" no graph area will be generated. This ID is defined in graph.containerId property.");
                      graph.isActive = false;
                  } else {
                      graph.isActive = true;
              Severity: Major
              Found in src/popoto.js and 4 other locations - About 1 hr to fix
              src/popoto.js on lines 78..83
              src/popoto.js on lines 85..90
              src/popoto.js on lines 92..97
              src/popoto.js on lines 99..104

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

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

                  if (queryHTMLContainer.empty()) {
                      logger.debug("The page doesn't contain a container with ID = \"" + queryviewer.containerId + "\" no query viewer will be generated. This ID is defined in queryviewer.containerId property.");
                      queryviewer.isActive = false;
                  } else {
                      queryviewer.isActive = true;
              Severity: Major
              Found in src/popoto.js and 4 other locations - About 1 hr to fix
              src/popoto.js on lines 71..76
              src/popoto.js on lines 78..83
              src/popoto.js on lines 92..97
              src/popoto.js on lines 99..104

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

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

                  if (taxonomyHTMLContainer.empty()) {
                      logger.debug("The page doesn't contain a container with ID = \"" + taxonomy.containerId + "\" no taxonomy filter will be generated. This ID is defined in taxonomy.containerId property.");
                      taxonomy.isActive = false;
                  } else {
                      taxonomy.isActive = true;
              Severity: Major
              Found in src/popoto.js and 4 other locations - About 1 hr to fix
              src/popoto.js on lines 71..76
              src/popoto.js on lines 85..90
              src/popoto.js on lines 92..97
              src/popoto.js on lines 99..104

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

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

                  if (resultsHTMLContainer.empty()) {
                      logger.debug("The page doesn't contain a container with ID = \"" + result.containerId + "\" no result area will be generated. This ID is defined in result.containerId property.");
                      result.isActive = false;
                  } else {
                      result.isActive = true;
              Severity: Major
              Found in src/popoto.js and 4 other locations - About 1 hr to fix
              src/popoto.js on lines 71..76
              src/popoto.js on lines 78..83
              src/popoto.js on lines 85..90
              src/popoto.js on lines 92..97

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

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

                  if (cypherHTMLContainer.empty()) {
                      logger.debug("The page doesn't contain a container with ID = \"" + cypherviewer.containerId + "\" no cypher query viewer will be generated. This ID is defined in cypherviewer.containerId property.");
                      cypherviewer.isActive = false;
                  } else {
                      cypherviewer.isActive = true;
              Severity: Major
              Found in src/popoto.js and 4 other locations - About 1 hr to fix
              src/popoto.js on lines 71..76
              src/popoto.js on lines 78..83
              src/popoto.js on lines 85..90
              src/popoto.js on lines 99..104

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

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

              node.updateMiddlegroundElementsSymbol = function (gMiddlegroundSymbolNodes) {
                  gMiddlegroundSymbolNodes.append("circle").attr("r", function (n) {
                      return provider.node.getSize(n);
                  })
                      .attr("class", function (n) {
              Severity: Minor
              Found in src/graph/node/node.js - About 1 hr to fix

                Function nodeClick has 34 lines of code (exceeds 25 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 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language