rmit-programming-club/network-vis

View on GitHub

Showing 9 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

              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

              Severity
              Category
              Status
              Source
              Language