fbi-cde/crime-data-api

View on GitHub

Showing 117 of 117 total issues

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

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 clean has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def clean():
    """Remove *.pyc and *.pyo files recursively starting at current directory.

    Borrowed from Flask-Script, converted to use Click.
    """
Severity: Minor
Found in crime_data/commands.py - About 35 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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, state = None, agency = None, year = None, county = None, classification = None):
        """Get Agency Sums given a state/year/county/agency ori, etc."""
        query = AgencyClassificationCounts.query

        if state:
Severity: Minor
Found in crime_data/common/newmodels.py - About 35 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

Avoid too many return statements within this function.
Open

            return ('nibrs_offense_type','offense_name')
Severity: Major
Found in crime_data/common/cdemodels.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return ('nibrs_location_type','location_name')
    Severity: Major
    Found in crime_data/common/cdemodels.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return (None, None)
      Severity: Major
      Found in crime_data/common/cdemodels.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return ('nibrs_victim_type','victim_type_name')
        Severity: Major
        Found in crime_data/common/cdemodels.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return ('nibrs_resident_status_code','resident_status_code')
          Severity: Major
          Found in crime_data/common/cdemodels.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return ('nibrs_victim_type','victim_type_name')
            Severity: Major
            Found in crime_data/common/cdemodels.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return ('ref_race','race_code')
              Severity: Major
              Found in crime_data/common/cdemodels.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return ('nibrs_sex_code','sex_code')
                Severity: Major
                Found in crime_data/common/cdemodels.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return ('nibrs_sex_code','sex_code')
                  Severity: Major
                  Found in crime_data/common/cdemodels.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return ('nibrs_age_num','age_num')
                    Severity: Major
                    Found in crime_data/common/cdemodels.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return ('nibrs_circumstances', 'circumstances_name')
                      Severity: Major
                      Found in crime_data/common/cdemodels.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return ('nibrs_prop_desc_type','prop_desc_name')
                        Severity: Major
                        Found in crime_data/common/cdemodels.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return ['Murder and Nonnegligent Manslaughter']
                          Severity: Major
                          Found in crime_data/resources/nibrs_counts.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return ('nibrs_resident_status_code','resident_status_code')
                            Severity: Major
                            Found in crime_data/common/cdemodels.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return ('ref_race','race_code')
                              Severity: Major
                              Found in crime_data/common/cdemodels.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return ('nibrs_ethnicity','ethnicity_name')
                                Severity: Major
                                Found in crime_data/common/cdemodels.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return ('nibrs_age_num','age_num')
                                  Severity: Major
                                  Found in crime_data/common/cdemodels.py - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language