codeforamerica/resident-web-use-research

View on GitHub

Showing 16 of 240 total issues

File tract-hoods.py has 1067 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from osgeo import ogr
from csv import reader, DictReader
import json

neighborhoods_ds = ogr.Open('2768/neighborhoods.shp')
Severity: Major
Found in analysis-oakland-2014-10-27/tract-hoods.py - About 2 days to fix

    File lib.js has 451 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var RESPONSES = 'Survey responses',
        GREENS = 'Greens_05', BLUES = 'Blues_05', ORANGES = 'YlOrBr_05',
        GEO_COLUMN = 'Geographic Area',
        CR_API_BASE = 'http://api.censusreporter.org/1.0',
        CR_API_PAGE = 60;
    Severity: Minor
    Found in lib.js - About 6 hrs to fix

      Function surveyResults has 151 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      ResidentResearch.surveyResults = function() {
        var spreadsheet_url= null,
        responses= null, tracts= null,
        city= {name: null, geoid: null},
        maps= {
      Severity: Major
      Found in survey-results.js - About 6 hrs to fix

        Function map has 139 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        ResidentResearch.map = function() {
          var elementId = "",
            popupOpened = false,
          geojson = {},
          style = {},
        Severity: Major
        Found in map.js - About 5 hrs to fix

          Function censusReporter has 129 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          ResidentResearch.censusReporter = function(tracts) {
            tracts = tracts;
            resultData = [];
          
            var appendData = function(tract) {
          Severity: Major
          Found in census-reporter.js - About 5 hrs to fix

            Function surveyResults has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

            ResidentResearch.surveyResults = function() {
              var spreadsheet_url= null,
              responses= null, tracts= null,
              city= {name: null, geoid: null},
              maps= {
            Severity: Minor
            Found in survey-results.js - About 3 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 map has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            ResidentResearch.map = function() {
              var elementId = "",
                popupOpened = false,
              geojson = {},
              style = {},
            Severity: Minor
            Found in map.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

            Function load_spreadsheet has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            function load_spreadsheet(gdoc_url, sheet_name, onsuccess, onerror)
            {
                Tabletop.init({
                    key: gdoc_url, callback: callback,
                    simpleSheet: true, wanted: [sheet_name]
            Severity: Minor
            Found in lib.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 get_style_function has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function get_style_function(tracts, data_point, colors)
            {
                var value, data = {},
                    histogram = [], minimum, maximum,
                    color_list = get_color_list(colors);
            Severity: Minor
            Found in lib.js - About 1 hr to fix

              Function correlation has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              ResidentResearch.correlation = function() {
              
                with_no_population = function(object_to_filter) {
                    return object_to_filter.population !== false;
                }
              Severity: Minor
              Found in lib.js - About 1 hr to fix

                Function load_spreadsheet has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function load_spreadsheet(gdoc_url, sheet_name, onsuccess, onerror)
                {
                    Tabletop.init({
                        key: gdoc_url, callback: callback,
                        simpleSheet: true, wanted: [sheet_name]
                Severity: Minor
                Found in lib.js - About 1 hr to fix

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

                    var loaded_spreadsheet = function(all_responses, spreadsheet_url) {
                      responses = all_responses;
                      spreadsheet_url = spreadsheet_url;
                      var geo_responses = [],
                          languages = {
                  Severity: Minor
                  Found in survey-results.js - About 1 hr to fix

                    Function calculate_regression has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function calculate_regression(tracts, numerator, denominator)
                    {
                        var points = [],
                            total = 0;
                        
                    Severity: Minor
                    Found in lib.js - About 1 hr to fix

                      Function callback has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function callback(data, ttop)
                          {
                              var responses = [];
                          
                              try {
                      Severity: Minor
                      Found in lib.js - About 1 hr to fix

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

                        function timedChunk(items, process, context, callback, chunkCallback){
                        Severity: Minor
                        Found in lib.js - About 35 mins to fix

                          Function calculate_regression has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function calculate_regression(tracts, numerator, denominator)
                          {
                              var points = [],
                                  total = 0;
                              
                          Severity: Minor
                          Found in lib.js - About 25 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