KAMI911/osm_poi_matchmaker

View on GitHub

Showing 109 of 335 total issues

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

def download_content(link, verify_link=config.get_download_verify_link(), post_parm=None, headers=None,
                     encoding='utf-8'):
    try:
        if post_parm is None:
            logging.debug('Downloading without post parameters.')
Severity: Minor
Found in osm_poi_matchmaker/libs/soup.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 query_name_road_around has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def query_name_road_around(self, lon, lat, name='', with_metadata=True, mode='both'):
        '''
        Search for road with name specified around the lon, lat point location in OpenStreetMap database based on
        within preconfigured distance
        :param lon: Longitude parameter. Looking for roads around this geom.
Severity: Minor
Found in osm_poi_matchmaker/dao/poi_base.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 export_grouped_poi_data_with_postcode_groups has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def export_grouped_poi_data_with_postcode_groups(data):
    try:
        # Generating CSV files group by poi_code and postcode
        output_dir = data[0]
        filename = data[1]
Severity: Minor
Found in osm_poi_matchmaker/libs/export.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 None
Severity: Major
Found in osm_poi_matchmaker/libs/geo.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return geom_point(lat, lon, proj)
    Severity: Major
    Found in osm_poi_matchmaker/libs/geo.py - About 30 mins to fix

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

      def relationer(relation_text):
          if relation_text is None:
              return None
          data = []
          for i in range(0, len(relation_text), 2):
      Severity: Minor
      Found in osm_poi_matchmaker/libs/osm.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

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

          def print(self):
              print(self.nodes)
              print(self.ways)
              for key, value in self.nodes.items():
                  print(key)
      Severity: Minor
      Found in osm_poi_matchmaker/libs/OSMObjects.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

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

          def __init__(self, db_connection, retry_counter=100, retry_sleep=30):
              reco = 0  # Actual retry counter
              self.db_retry_counter = retry_counter
              self.db_retry_sleep = retry_sleep
              self.db_connection = db_connection
      Severity: Minor
      Found in osm_poi_matchmaker/dao/poi_base.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

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

      def get_or_create_cache(session, model, **kwargs):
          if kwargs.get('osm_id') is not None and kwargs.get('osm_object_type'):
              instance = session.query(model) \
                  .filter_by(osm_id=kwargs.get('osm_id')).filter_by(osm_object_type=kwargs.get('poi_addr_city')).first()
          if instance:
      Severity: Minor
      Found in osm_poi_matchmaker/dao/data_handlers.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