KAMI911/osm_poi_matchmaker

View on GitHub

Showing 335 of 335 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def process(self):
        try:
            csv = pd.read_csv(self.link, encoding='UTF-8', sep=';', skiprows=1)
            if csv is not None:
                poi_dict = csv.to_dict('records')
Severity: Major
Found in osm_poi_matchmaker/dataproviders/hu_emobi_ev.py and 1 other location - About 4 days to fix
osm_poi_matchmaker/dataproviders/hu_mobiliti_ev.py on lines 47..87

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 429.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def process(self):
        try:
            csv = pd.read_csv(self.link, encoding='UTF-8', sep=';', skiprows=1)
            if csv is not None:
                poi_dict = csv.to_dict('records')
Severity: Major
Found in osm_poi_matchmaker/dataproviders/hu_mobiliti_ev.py and 1 other location - About 4 days to fix
osm_poi_matchmaker/dataproviders/hu_emobi_ev.py on lines 48..88

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 429.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function generate_osm_xml has a Cognitive Complexity of 205 (exceeds 5 allowed). Consider refactoring.
Open

def generate_osm_xml(df, session=None):
    """Crete OpenStreetMap (OSM XML) file from passed Panda Dataframe

    Args:
        df ([type]): [description]
Severity: Minor
Found in osm_poi_matchmaker/libs/file_output.py - About 4 days 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

POIDataset has 174 functions (exceeds 20 allowed). Consider refactoring.
Open

class POIDataset:
    """Contains all handled OSM tags
    """    
    def __init__(self):
        """
Severity: Major
Found in osm_poi_matchmaker/libs/poi_dataset.py - About 3 days to fix

    Function process has a Cognitive Complexity of 149 (exceeds 5 allowed). Consider refactoring.
    Open

        def process(self):
            try:
                soup = save_downloaded_soup('{}'.format(self.link), os.path.join(self.download_cache, self.filename),
                                            self.filetype)
                if soup is not None:
    Severity: Minor
    Found in osm_poi_matchmaker/dataproviders/hu_budapest_bank.py - About 3 days 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 process has a Cognitive Complexity of 147 (exceeds 5 allowed). Consider refactoring.
    Open

        def process(self):
            try:
                soup = save_downloaded_soup('{}'.format(self.link), os.path.join(self.download_cache, self.filename),
                                            self.filetype)
                for e in soup.findAll('post'):
    Severity: Minor
    Found in osm_poi_matchmaker/dataproviders/hu_posta.py - About 2 days 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 online_poi_matching has a Cognitive Complexity of 135 (exceeds 5 allowed). Consider refactoring.
    Open

    def online_poi_matching(args):
        data, comm_data = args
        try:
            db = POIBase('{}://{}:{}@{}:{}/{}'.format(config.get_database_type(), config.get_database_writer_username(),
                                                      config.get_database_writer_password(),
    Severity: Minor
    Found in osm_poi_matchmaker/libs/online_poi_matching.py - About 2 days 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

    File poi_dataset.py has 757 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    __author__ = 'kami911'
    
    try:
        import logging
    Severity: Major
    Found in osm_poi_matchmaker/libs/poi_dataset.py - About 1 day to fix

      File poi_base.py has 606 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      try:
          import logging
          import sys
          import geopandas as gpd
      Severity: Major
      Found in osm_poi_matchmaker/dao/poi_base.py - About 1 day to fix

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

                                    if 'H:' in i:
                                        try:
                                            op = i.replace('H:', '').split(
                                                '-')[0].strip()
                                        except IndexError as e:
        Severity: Major
        Found in osm_poi_matchmaker/dataproviders/hu_budapest_bank.py and 4 other locations - About 1 day to fix
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 97..109
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 110..122
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 123..135
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 136..148

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 149.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

                                    elif 'K:' in i:
                                        try:
                                            op = i.replace('K:', '').split(
                                                '-')[0].strip()
                                        except IndexError as e:
        Severity: Major
        Found in osm_poi_matchmaker/dataproviders/hu_budapest_bank.py and 4 other locations - About 1 day to fix
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 84..96
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 110..122
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 123..135
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 136..148

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 149.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

                                    elif 'P:' in i:
                                        try:
                                            op = i.replace('P:', '').split(
                                                '-')[0].strip()
                                        except IndexError as e:
        Severity: Major
        Found in osm_poi_matchmaker/dataproviders/hu_budapest_bank.py and 4 other locations - About 1 day to fix
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 84..96
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 97..109
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 110..122
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 123..135

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 149.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

                                    elif 'Sz:' in i:
                                        try:
                                            op = i.replace('Sz:', '').split(
                                                '-')[0].strip()
                                        except IndexError as e:
        Severity: Major
        Found in osm_poi_matchmaker/dataproviders/hu_budapest_bank.py and 4 other locations - About 1 day to fix
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 84..96
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 97..109
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 123..135
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 136..148

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 149.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

                                    elif 'Cs:' in i:
                                        try:
                                            op = i.replace('Cs:', '').split(
                                                '-')[0].strip()
                                        except IndexError as e:
        Severity: Major
        Found in osm_poi_matchmaker/dataproviders/hu_budapest_bank.py and 4 other locations - About 1 day to fix
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 84..96
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 97..109
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 110..122
        osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 136..148

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 149.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function process has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
        Open

            def process(self):
                try:
                    soup = save_downloaded_soup('{}'.format(self.link), os.path.join(self.download_cache, self.filename),
                                                self.filetype)
                    if soup is not None:
        Severity: Minor
        Found in osm_poi_matchmaker/dataproviders/hu_avia.py - About 1 day 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

        File address.py has 460 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        
        try:
            import logging
            import sys
        Severity: Minor
        Found in osm_poi_matchmaker/libs/address.py - About 7 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  if not isinstance(latitude, float):
                      la = PATTERN_COORDINATE.search(latitude.replace(',', '.').strip())
                      try:
                          if la is not None:
                              lat = la.group()
          Severity: Major
          Found in osm_poi_matchmaker/libs/geo.py and 1 other location - About 6 hrs to fix
          osm_poi_matchmaker/libs/geo.py on lines 51..65

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 108.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  if not isinstance(longitude, float):
                      lo = PATTERN_COORDINATE.search(longitude.replace(',', '.').strip())
                      try:
                          if lo is not None:
                              lon = lo.group()
          Severity: Major
          Found in osm_poi_matchmaker/libs/geo.py and 1 other location - About 6 hrs to fix
          osm_poi_matchmaker/libs/geo.py on lines 36..50

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 108.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def types(self):
                  humagnbank = {'amenity': 'bank',
                                'atm': 'yes', 'air_conditioning': 'yes', }
                  humagnbank.update(self.tags)
                  humagnatm = {'amenity': 'atm'}
          Severity: Major
          Found in osm_poi_matchmaker/dataproviders/hu_magnet_bank.py and 1 other location - About 6 hrs to fix
          osm_poi_matchmaker/dataproviders/hu_kh_bank.py on lines 35..52

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 105.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def types(self):
                  hukhbank = {'amenity': 'bank', 'atm': 'yes',
                              'air_conditioning': 'yes', }
                  hukhbank.update(self.tags)
                  hukhatm = {'amenity': 'atm'}
          Severity: Major
          Found in osm_poi_matchmaker/dataproviders/hu_kh_bank.py and 1 other location - About 6 hrs to fix
          osm_poi_matchmaker/dataproviders/hu_magnet_bank.py on lines 36..52

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 105.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language