codeforamerica/city-analytics-dashboard

View on GitHub

Showing 8 of 14 total issues

Function raphaelHelper has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.raphaelHelper = function() {
  var chart, options, elementHeight, data, yPos;
  function raphael(chart_) {
    chart = chart_;
    options = chart.options;
Severity: Minor
Found in public/javascripts/helpers/raphaelHelper.js - About 1 hr to fix

    Function parseResponse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        parseResponse: function(data){
          if(data && data.hasOwnProperty('rows')){
            var users = parseRows(data.rows);
            var activeUsers = parseInt(users['DESKTOP'], 10) | 0;
            var activeUsersMobile = parseInt(users['MOBILE'], 10) | 0;
    Severity: Minor
    Found in public/javascripts/traffic.js - About 1 hr to fix

      Function raphaelHelper has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      window.raphaelHelper = function() {
        var chart, options, elementHeight, data, yPos;
        function raphael(chart_) {
          chart = chart_;
          options = chart.options;
      Severity: Minor
      Found in public/javascripts/helpers/raphaelHelper.js - About 45 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

      Function addTerm has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          addTerm: function(term, count, url, source, deviceCategory){
      Severity: Minor
      Found in public/javascripts/landing-pages.js - About 35 mins to fix

        Avoid too many return statements within this function.
        Open

                return false;
        Severity: Major
        Found in public/javascripts/search.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return false;
          Severity: Major
          Found in public/javascripts/search.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return true;
            Severity: Major
            Found in public/javascripts/search.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return true;
              Severity: Major
              Found in public/javascripts/landing-pages.js - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language