codeforamerica/resident-web-use-research

View on GitHub

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

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

                                tract_geoid = row['State FIPS'] + row['County FIPS'] + row['Tract']
                        Severity: Minor
                        Found in analysis-oakland-2014-10-27/acs/aggregate.py and 1 other location - About 45 mins to fix
                        analysis-oakland-2014-10-27/tract-hoods.py on lines 1150..1150

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

                        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

                                geoid = row['State FIPS'] + row['County FIPS'] + row['Tract']
                        Severity: Minor
                        Found in analysis-oakland-2014-10-27/tract-hoods.py and 1 other location - About 45 mins to fix
                        analysis-oakland-2014-10-27/acs/aggregate.py on lines 10..10

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

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

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

                              var message = ('Found ' + tracts.length + ' tracts in ' + city.name + ' and <a target="_blank" href="' + spreadsheet_url + '">a spreadsheet with ' + geo_responses.length + ' geographic responses</a>.');
                          Severity: Minor
                          Found in survey-results.js and 1 other location - About 30 mins to fix
                          survey-results.js on lines 132..132

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

                              elif key in zipcodes:
                                  print key, 'is a zipcode'
                                  if key not in areas:
                                      areas[key] = zipcodes[key]
                          Severity: Major
                          Found in analysis-oakland-2014-10-27/tract-hoods.py and 4 other locations - About 30 mins to fix
                          analysis-oakland-2014-10-27/tract-hoods.py on lines 1097..1100
                          analysis-oakland-2014-10-27/tract-hoods.py on lines 1105..1108
                          analysis-oakland-2014-10-27/tract-hoods.py on lines 1109..1112
                          analysis-oakland-2014-10-27/tract-hoods.py on lines 1113..1116

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

                          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

                              elif key in regions:
                                  print key, 'is a region'
                                  if key not in areas:
                                      areas[key] = regions[key]
                          Severity: Major
                          Found in analysis-oakland-2014-10-27/tract-hoods.py and 4 other locations - About 30 mins to fix
                          analysis-oakland-2014-10-27/tract-hoods.py on lines 1097..1100
                          analysis-oakland-2014-10-27/tract-hoods.py on lines 1101..1104
                          analysis-oakland-2014-10-27/tract-hoods.py on lines 1109..1112
                          analysis-oakland-2014-10-27/tract-hoods.py on lines 1113..1116

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

                          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