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')
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;
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= {
Function map
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
ResidentResearch.map = function() {
var elementId = "",
popupOpened = false,
geojson = {},
style = {},
Function censusReporter
has 129 lines of code (exceeds 25 allowed). Consider refactoring. Open
ResidentResearch.censusReporter = function(tracts) {
tracts = tracts;
resultData = [];
var appendData = function(tract) {
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= {
- Read upRead up
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 = {},
- Read upRead up
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]
- Read upRead up
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);
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;
}
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]
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 = {
Function calculate_regression
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function calculate_regression(tracts, numerator, denominator)
{
var points = [],
total = 0;
Function callback
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function callback(data, ttop)
{
var responses = [];
try {
Similar blocks of code found in 2 locations. Consider refactoring. Open
tract_geoid = row['State FIPS'] + row['County FIPS'] + row['Tract']
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
geoid = row['State FIPS'] + row['County FIPS'] + row['Tract']
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function timedChunk
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function timedChunk(items, process, context, callback, chunkCallback){
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>.');
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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]
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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]
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76