rmit-programming-club/network-vis

View on GitHub

Showing 16 of 16 total issues

Function drawGraph has 309 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function drawGraph(orgName) {
  var name = orgName
  // Remove any existing graph
  d3.select("#graph-container").select("svg").remove();
  console.log("drawGraph Called");
Severity: Major
Found in app-js/d3/network.js - About 1 day to fix

    Consider simplifying this complex logical expression.
    Open

          } else if (d3CurrentEvent.keyCode>=48 && d3CurrentEvent.keyCode<=90 && !d3CurrentEvent.ctrlKey && !d3CurrentEvent.altKey && !d3CurrentEvent.metaKey) {
            switch (String.fromCharCode(d3CurrentEvent.keyCode)) {
              case "C": keyc = !keyc; break;
              case "S": keys = !keys; break;
                case "T": keyt = !keyt; break;
    Severity: Critical
    Found in app-js/d3/network.js - About 3 hrs to fix

      File network.js has 314 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as d3 from "d3";
      import {event as d3CurrentEvent} from 'd3';
      
      function drawGraph(orgName) {
        var name = orgName
      Severity: Minor
      Found in app-js/d3/network.js - About 3 hrs to fix

        Method index has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def index
            set_org
        
            data = Rails.cache.fetch @org
            if !data.nil?
        Severity: Major
        Found in app/controllers/organizations_controller.rb - About 2 hrs to fix

          Function drawGraph has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          function drawGraph(orgName) {
            var name = orgName
            // Remove any existing graph
            d3.select("#graph-container").select("svg").remove();
            console.log("drawGraph Called");
          Severity: Minor
          Found in app-js/d3/network.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

          Method connected_members has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            def connected_members(user_events)
              connected = {}
              members = organisation_members(params.fetch('organisation_name'))
              repos = Set.new
              # build list of repos and their contributors
          Severity: Minor
          Found in app/controllers/profiles_controller.rb - 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 keydown has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function keydown() {
                  if (d3CurrentEvent.keyCode==32) {
                  force.stop();
                } else if (d3CurrentEvent.keyCode>=48 && d3CurrentEvent.keyCode<=90 && !d3CurrentEvent.ctrlKey && !d3CurrentEvent.altKey && !d3CurrentEvent.metaKey) {
                  switch (String.fromCharCode(d3CurrentEvent.keyCode)) {
          Severity: Minor
          Found in app-js/d3/network.js - About 1 hr to fix

            Function draw has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function draw(data) {
                var color = d3.scale.ordinal(d3.schemeSet2);
                var width = 420,
                    barHeight = 20;
            
            
            Severity: Minor
            Found in app-js/d3/graph.js - About 1 hr to fix

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

                function vis_by_link_score(score) {
                    if (isNumber(score)) {
                      if (score>=0.666) return key3;
                      else if (score>=0.333) return key2;
                      else if (score>=0) return key1;
              Severity: Major
              Found in app-js/d3/network.js and 1 other location - About 1 hr to fix
              app-js/d3/network.js on lines 356..363

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

              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

                function vis_by_node_score(score) {
                    if (isNumber(score)) {
                      if (score>=0.666) return keyh;
                      else if (score>=0.333) return keym;
                      else if (score>=0) return keyl;
              Severity: Major
              Found in app-js/d3/network.js and 1 other location - About 1 hr to fix
              app-js/d3/network.js on lines 365..372

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

              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 link = g.selectAll(".link")
                    .data(graph.links)
                    .enter().append("line")
                    .attr("class", "link")
                      .style("stroke-width",nominal_stroke)
              Severity: Major
              Found in app-js/d3/network.js and 2 other locations - About 45 mins to fix
              app-js/d3/network.js on lines 101..105
              app-js/d3/network.js on lines 138..142

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

              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 text = g.selectAll(".text")
                    .data(graph.nodes)
                    .enter().append("text")
                    .attr("dy", ".35em")
                    .attr("fill", "#bbff99")
              Severity: Major
              Found in app-js/d3/network.js and 2 other locations - About 45 mins to fix
              app-js/d3/network.js on lines 90..94
              app-js/d3/network.js on lines 101..105

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

              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 node = g.selectAll(".node")
                    .data(graph.nodes)
                    .enter().append("g")
                    .attr("class", "node")
                    .call(force.drag);
              Severity: Major
              Found in app-js/d3/network.js and 2 other locations - About 45 mins to fix
              app-js/d3/network.js on lines 90..94
              app-js/d3/network.js on lines 138..142

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

              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

              Method index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def index
                  set_org
              
                  data = Rails.cache.fetch @org
                  if !data.nil?
              Severity: Minor
              Found in app/controllers/organizations_controller.rb - 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

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

                    text.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
              Severity: Minor
              Found in app-js/d3/network.js and 1 other location - About 30 mins to fix
              app-js/d3/network.js on lines 273..273

              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

                    node.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
              Severity: Minor
              Found in app-js/d3/network.js and 1 other location - About 30 mins to fix
              app-js/d3/network.js on lines 274..274

              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

              Severity
              Category
              Status
              Source
              Language