AerodyneLabs/Athena

View on GitHub

Showing 11 of 32 total issues

Function update_centers has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

def update_centers():
    effective = helpers.get_latest_date()
    logger.info("Updating ARTCC information to %s NASR cycle...", effective)

    data = {}
Severity: Minor
Found in app/airspace/tasks/center.py - About 5 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 update_airspace has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def update_airspace():
    effective = helpers.get_latest_date()
    logger.info("Updating airspace information to %s NASR cycle...", effective)

    as_fn = helpers.download_latest_file('class_airspace_shape_files.zip')
Severity: Minor
Found in app/airspace/tasks/airspace.py - 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 update_navaids has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def update_navaids():
    count = 0
    effective = helpers.get_latest_date()
    logger.info("Updating navaid information to %s NASR cycle...", effective)

Severity: Minor
Found in app/airspace/tasks/navaid.py - 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 update_towers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def update_towers():
    effective = helpers.get_latest_date()
    logger.info("Updating tower information to %s NASR cycle...", effective)

    defferred = []
Severity: Minor
Found in app/airspace/tasks/tower.py - 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

Avoid deeply nested control flow statements.
Open

                    if facility_type == 'ARTCC':
                        facility_id = helpers.get_field(line, AFF_FIELDS['facility_id'])
                        facility_name = helpers.get_field(line, AFF_FIELDS['name'])
                        location = helpers.get_field(line, AFF_FIELDS['location'])
                        state = helpers.get_field(line, AFF_FIELDS['state_code'])
Severity: Major
Found in app/airspace/tasks/center.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if result[1]:
                        logger.info("Created %s-%s...", facility_id, data['name'])
                    else:
                        logger.info("Updated %s-%s...", facility_id, data['name'])
    remove(twr_fn)
Severity: Major
Found in app/airspace/tasks/tower.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if airspace_created:
                        logger.info("Created airspace %s", airspace)
                    else:
                        logger.info("Updated airspace %s", airspace)
                        AirspaceVolume.objects.filter(parent=airspace_obj).delete()
Severity: Major
Found in app/airspace/tasks/airspace.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if cur_facility != '':
                        # if cur_alt == 'HIGH':
                        cur_points.append(cur_points[0])
                        # poly = Polygon(cur_points).buffer(0)
                        # if isinstance(poly, Polygon):
Severity: Major
Found in app/airspace/tasks/center.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if facility_type in TYPE_FILTER:
                        country = helpers.get_field(line, NAV_FIELDS['country'])
                        if country != "": continue
                        code = helpers.get_field(line, NAV_FIELDS['facility_id'])
                        name = helpers.get_field(line, NAV_FIELDS['name'])
Severity: Major
Found in app/airspace/tasks/navaid.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if master_id is not '':
                        data['master'] = master_id
                        defferred.append(data)
                        continue

Severity: Major
Found in app/airspace/tasks/tower.py - About 45 mins to fix

Function gfs_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def gfs_url(model_run=datetime.now(tz=pytz.utc), forecast_time=datetime.now(tz=pytz.utc), resolution=GFS_1_0_DEGREE):
    # Ensure times are not naive
    if model_run.tzinfo is None or model_run.tzinfo.utcoffset(model_run) is None:
        raise ValueError('model_run (%s) is naive!', model_run)
    if forecast_time.tzinfo is None or forecast_time.tzinfo.utcoffset(forecast_time) is None:
Severity: Minor
Found in app/atmosphere/tasks/nomads.py - 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