fga-gpp-mds/2017.2-QueroCultura

View on GitHub

Showing 11 of 88 total issues

Function populate_event_data has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def populate_event_data():
    if len(LastUpdateEventDate.objects) == 0:
        LastUpdateEventDate(DEFAULT_INITIAL_DATE).save()

    size = LastUpdateEventDate.objects.count()
Severity: Minor
Found in events_indicators/views.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 populate_agent_data has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def populate_agent_data():
    if len(LastUpdateAgentsDate.objects) == 0:
        LastUpdateAgentsDate(DEFAULT_INITIAL_DATE).save()

    size = LastUpdateAgentsDate.objects.count()
Severity: Minor
Found in agents_indicators/views.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 populate_mixed_data has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def populate_mixed_data(last_update):

    for event in RequestMixedIndicatorsRawData(last_update).data:
        for occurrences in event.occurrences:
            if occurrences['space'] != None:
Severity: Minor
Found in mixed_indicators/views.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 populate_library_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def populate_library_data():
    if len(LastUpdateLibraryDate.objects) == 0:
        LastUpdateLibraryDate(DEFAULT_INITIAL_DATE).save()

    size = LastUpdateLibraryDate.objects.count()
Severity: Minor
Found in library_indicators/views.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 populate_museum_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def populate_museum_data():
    if len(LastUpdateMuseumDate.objects) == 0:
        LastUpdateMuseumDate(DEFAULT_INITIAL_DATE).save()

    size = LastUpdateMuseumDate.objects.count()
Severity: Minor
Found in museums_indicators/views.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 get_marker_address has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def get_marker_address(location):
    if location is not None:
        if location['latitude'] != '0' or location['longitude'] != '0':

            latitude = "lat=" + location['latitude']
Severity: Minor
Found in quero_cultura/api_connections.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 exports has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',
Severity: Minor
Found in karma.conf.js - About 1 hr to fix

    Function get_location has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_location(j_object, marker_type):
        if marker_type == 'project':
            if j_object['owner'] is not None:
                location = j_object['owner']['location']
            else:
    Severity: Minor
    Found in quero_cultura/api_connections.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 populate_project_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def populate_project_data():
        if len(LastUpdateProjectDate.objects) == 0:
            LastUpdateProjectDate(DEFAULT_INITIAL_DATE).save()
    
        size = LastUpdateProjectDate.objects.count()
    Severity: Minor
    Found in project_indicators/views.py - 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

    Avoid deeply nested control flow statements.
    Open

                        if occurrences['space']['acessibilidade'] != '':
                            accessible_space = str(occurrences['space'][
                                'acessibilidade']).capitalize()
    
                            EventAndSpaceData(event.instance, str(
    Severity: Major
    Found in mixed_indicators/views.py - About 45 mins to fix

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

      def populate_space_data():
          if len(LastUpdateDate.objects) == 0:
              LastUpdateDate(DEFAULT_INITIAL_DATE).save()
      
          size = LastUpdateDate.objects.count()
      Severity: Minor
      Found in space_indicators/views.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

      Severity
      Category
      Status
      Source
      Language