18F/crime-data-api

View on GitHub

Showing 91 of 91 total issues

Function base_query has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def base_query(self, field):
 
if self.explorer_offense:
query = 'SELECT b.:field, SUM(a.count)::int AS count, :explorer_offense AS offense_name, b.year FROM (SELECT year::text, offense_name, :field, count'
else:
Severity: Minor
Found in crime_data/common/cdemodels.py - About 1 hr to fix

Function _parse_inequality_operator has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _parse_inequality_operator(self, k, v):
"""
Returns (key, value, comparitor)
"""
if v:
Severity: Minor
Found in crime_data/common/base.py - About 1 hr to fix

Function filtered has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def filtered(cls, filters, args=None):
args = args or []
qry = cls.query
 
# This could be generalized to other places in the future
Severity: Minor
Found in crime_data/common/newmodels.py - About 1 hr to fix

Function with_metadata has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def with_metadata(self, results, args, schema = None):
"""Paginates results and wraps them in metadata."""
 
count = 0
try:
Severity: Minor
Found in crime_data/common/base.py - About 1 hr to fix

Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def __init__(self, field, year=None, state_id=None, ori=None,
Severity: Major
Found in crime_data/common/cdemodels.py - About 1 hr to fix

Function base_query has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def base_query(self, field):
select_query = 'SELECT b.:field, a.count, b.year FROM (SELECT :field , count, year::text'
from_query = ' FROM :view_name'
where_query = ' WHERE :field IS NOT NULL'
 
 
Severity: Minor
Found in crime_data/common/cdemodels.py - About 55 mins to fix

Function output_serialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def output_serialize(self,
data,
schema=None,
format='csv',
aggregate_many=False):
Severity: Minor
Found in crime_data/common/base.py - About 55 mins to fix

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

def query(self, args):
base_query = None
qry = None
param_dict = {}
try:
Severity: Minor
Found in crime_data/common/cdemodels.py - About 45 mins to fix

Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def __init__(self, field, year=None, state_id=None, state_abbr=None, ori=None, as_json=True):
Severity: Minor
Found in crime_data/common/cdemodels.py - About 45 mins to fix

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

def base_query(self, field):
 
query = 'SELECT b.:field, a.count, b.year FROM (SELECT :field ,stolen_value::text, recovered_value::text, year::text, count'
query += ' FROM :view_name '
where_query = ' WHERE :field IS NOT NULL'
Severity: Minor
Found in crime_data/common/cdemodels.py - About 45 mins to fix

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

def get(self, args, variable, state_id=None, state_abbr=None, ori=None):
Severity: Minor
Found in crime_data/resources/cargo_theft.py - About 35 mins to fix

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

def get(self, args, variable, state_id=None, state_abbr=None, ori=None):
Severity: Minor
Found in crime_data/resources/offenses.py - About 35 mins to fix

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

def get(self, args, variable, state_id=None, state_abbr=None, ori=None):
Severity: Minor
Found in crime_data/resources/hate_crime.py - About 35 mins to fix

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

def get(self, args, variable, state_id=None, state_abbr=None, ori=None):
Severity: Minor
Found in crime_data/resources/victims.py - About 35 mins to fix

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

def get(self, state = None, agency = None, year = None, county = None, explorer_offense = None):
Severity: Minor
Found in crime_data/common/newmodels.py - About 35 mins to fix

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

def get(self, state = None, agency = None, year = None, county = None, explorer_offense = None):
Severity: Minor
Found in crime_data/common/newmodels.py - About 35 mins to fix

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

def get(self, args, variable, state_id=None, state_abbr=None, ori=None):
Severity: Minor
Found in crime_data/resources/offenders.py - About 35 mins to fix

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

def get(self, state = None, agency = None, year = None, county = None, classification = None):
Severity: Minor
Found in crime_data/common/newmodels.py - About 35 mins to fix

Function __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def __init__(self, field, year=None, state_id=None, ori=None,
offense_name=None, state_abbr=None, explorer_offense=None, as_json=True):
 
self.as_json = as_json
 
 
Severity: Minor
Found in crime_data/common/cdemodels.py - About 35 mins to fix

Function get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get(self, state = None, agency = None, year = None, county = None, explorer_offense = None):
"""Get Agency Sums given a state/year/county/agency ori, etc."""
query = AgencyOffenseCounts.query
 
if state:
Severity: Minor
Found in crime_data/common/newmodels.py - About 35 mins to fix
Severity
Category
Status
Source
Language