bdurand/us_geo

View on GitHub

Showing 31 of 68 total issues

Method add_counties has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def add_counties(urban_areas)
      foreach(data_file(USGeoData::URBAN_AREA_COUNTY_REL_FILE), col_sep: "|") do |row|
        urban_area_geoid = row["GEOID_UA_20"]
        county_geoid = row["GEOID_COUNTY_20"]
        urban_area_land_area = row["AREALAND_UA_20"].to_f * SQUARE_METERS_TO_MILES
Severity: Minor
Found in data/lib/us_geo_data/urban_area.rb - About 55 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

Method add_zctas has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def add_zctas(urban_areas)
      foreach(data_file(USGeoData::ZCTA_URBAN_AREA_REL_FILE), col_sep: "|") do |row|
        urban_area_geoid = row["GEOID_UA_20"]
        zcta5 = row["GEOID_ZCTA5_20"]
        overlap_land_area = row["AREALAND_PART"].to_f * SQUARE_METERS_TO_MILES
Severity: Minor
Found in data/lib/us_geo_data/urban_area.rb - About 55 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

Method subdivision_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def subdivision_data
      unless defined?(@subdivision_data)
        gnis_subdivisions = gnis_subdivision_mapping

        subdivisions = {}
Severity: Minor
Found in data/lib/us_geo_data/county_subdivision.rb - About 45 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

Method dump_csv has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def dump_csv(output)
      CSV.new(output).tap do |csv|
        csv << ["Name", "Code", "Type", "FIPS", "Region ID", "Region", "Division ID", "Division", "Population", "Housing Units", "Land Area", "Water Area"]
        state_data.each_value do |data|
          csv << [
Severity: Minor
Found in data/lib/us_geo_data/state.rb - About 45 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

Method dump_csv has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def dump_csv(output)
      csv = CSV.new(output)
      csv << ["GEOID", "GNIS ID", "Name", "Short Name", "State", "CBSA", "Metropolitan Division", "Central", "Time Zone", "Time Zone 2", "FIPS Class", "Population", "Housing Units", "Land Area", "Water Area", "Latitude", "Longitude"]
      county_data.each_value do |data|
        unless data[:time_zone] && data[:gnis_id] && data[:fips_class]
Severity: Minor
Found in data/lib/us_geo_data/county.rb - About 45 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

Method add_counties has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def add_counties(data)
      foreach(processed_file(Gnis::PLACE_COUNTIES_FILE), col_sep: ",") do |row|
        place_geoid = row["Place GEOID"]
        county_geoid = row["County GEOID"]

Severity: Minor
Found in data/lib/us_geo_data/place.rb - 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

Method place_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def place_data
      unless defined?(@place_data)
        places = {}

        gnis_places = gnis_place_mapping
Severity: Minor
Found in data/lib/us_geo_data/place.rb - 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

Method density has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def density(density)
    return nil unless density

    round = if density < 1
      3
Severity: Minor
Found in explorer_app/app/helpers/application_helper.rb - 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

Method index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    cbsas = if @combined_statistical_area
      @combined_statistical_area.core_based_statistical_areas.order(:name)
    else
      USGeo::CoreBasedStatisticalArea.not_removed.order(:name)
Severity: Minor
Found in explorer_app/app/controllers/core_based_statistical_areas_controller.rb - 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

Method add_gazetteer_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def add_gazetteer_data(counties)
      foreach(data_file(USGeoData::COUNTY_GAZETTEER_FILE), col_sep: "\t") do |row|
        county_geoid = row["GEOID"]
        data = counties[county_geoid]
        unless data
Severity: Minor
Found in data/lib/us_geo_data/county.rb - 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

Method auto_round has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def auto_round(number)
    return number unless number.is_a?(Float)

    decimals = if number < 1
      3
Severity: Minor
Found in explorer_app/app/helpers/application_helper.rb - 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