KAMI911/osm_poi_matchmaker

View on GitHub
osm_poi_matchmaker/dataproviders/hu_mobil_petrol.py

Summary

Maintainability
D
1 day
Test Coverage

Function process has a Cognitive Complexity of 25 (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_mobil_petrol.py - About 3 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

Avoid deeply nested control flow statements.
Open

                            for i in range(0, 7):
                                self.data.day_open(i, open_from)
                                self.data.day_close(i, open_to)
                        self.data.public_holiday_open = False
Severity: Major
Found in osm_poi_matchmaker/dataproviders/hu_mobil_petrol.py - About 45 mins to fix

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

        def constains(self):
            self.link = 'http://www.mpetrol.hu/'
            self.tags = {'amenity': 'fuel', 'brand': 'Mobil Petrol', 'contact:email': 'info@mpetrol.hu',
                         'contact:facebook': 'https://www.facebook.com/mpetrolofficial/', 'name': 'Mobil Petrol',
                         'operator:addr': '1095 Budapest, Ipar utca 2.', 'operator': 'MPH Power Zrt.', 'fuel:diesel': 'yes',
    Severity: Major
    Found in osm_poi_matchmaker/dataproviders/hu_mobil_petrol.py and 1 other location - About 3 hrs to fix
    osm_poi_matchmaker/dataproviders/hu_jysk.py on lines 25..33

    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 71.

    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):
            humobpefu = self.tags.copy()
            humobpefu.update(POS_HU_GEN)
            humobpefu.update(PAY_CASH)
            self.__types = [
    Severity: Major
    Found in osm_poi_matchmaker/dataproviders/hu_mobil_petrol.py and 1 other location - About 3 hrs to fix
    osm_poi_matchmaker/dataproviders/hu_takko.py on lines 35..43

    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 63.

    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 4 locations. Consider refactoring.
    Open

                        self.data.lat, self.data.lon = check_hu_boundary(poi_data['location']['lat'],
                                                                         poi_data['location']['lng'])
    Severity: Major
    Found in osm_poi_matchmaker/dataproviders/hu_mobil_petrol.py and 3 other locations - About 1 hr to fix
    osm_poi_matchmaker/dataproviders/hu_obi.py on lines 58..59
    osm_poi_matchmaker/dataproviders/hu_penny_market.py on lines 61..62
    osm_poi_matchmaker/dataproviders/hu_pepco.py on lines 71..73

    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 45.

    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 'open_from' in locals() and 'open_to' in locals():
                                for i in range(0, 7):
                                    self.data.day_open(i, open_from)
                                    self.data.day_close(i, open_to)
    Severity: Minor
    Found in osm_poi_matchmaker/dataproviders/hu_mobil_petrol.py and 1 other location - About 45 mins to fix
    osm_poi_matchmaker/dataproviders/hu_omv.py on lines 82..84

    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 35.

    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

    Identical blocks of code found in 21 locations. Consider refactoring.
    Open

                soup = save_downloaded_soup('{}'.format(self.link), os.path.join(self.download_cache, self.filename),
                                            self.filetype)
    Severity: Major
    Found in osm_poi_matchmaker/dataproviders/hu_mobil_petrol.py and 20 other locations - About 40 mins to fix
    osm_poi_matchmaker/dataproviders/hu_aldi.py on lines 48..49
    osm_poi_matchmaker/dataproviders/hu_avia.py on lines 50..51
    osm_poi_matchmaker/dataproviders/hu_benu.py on lines 50..51
    osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 57..58
    osm_poi_matchmaker/dataproviders/hu_cba.py on lines 65..66
    osm_poi_matchmaker/dataproviders/hu_dm.py on lines 50..51
    osm_poi_matchmaker/dataproviders/hu_foxpost.py on lines 50..51
    osm_poi_matchmaker/dataproviders/hu_jysk.py on lines 49..50
    osm_poi_matchmaker/dataproviders/hu_mol_bubi.py on lines 42..43
    osm_poi_matchmaker/dataproviders/hu_obi.py on lines 48..49
    osm_poi_matchmaker/dataproviders/hu_oil.py on lines 50..51
    osm_poi_matchmaker/dataproviders/hu_penny_market.py on lines 50..51
    osm_poi_matchmaker/dataproviders/hu_pepco.py on lines 50..51
    osm_poi_matchmaker/dataproviders/hu_posta.py on lines 73..74
    osm_poi_matchmaker/dataproviders/hu_posta_json.py on lines 71..72
    osm_poi_matchmaker/dataproviders/hu_sber_bank.py on lines 54..55
    osm_poi_matchmaker/dataproviders/hu_spar.py on lines 68..69
    osm_poi_matchmaker/dataproviders/hu_tesco.py on lines 81..82
    osm_poi_matchmaker/dataproviders/hu_tom_market.py on lines 45..46
    osm_poi_matchmaker/dataproviders/hu_yves_rocher.py on lines 52..53

    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 34.

    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

    There are no issues that match your filters.

    Category
    Status