KAMI911/osm_poi_matchmaker

View on GitHub
osm_poi_matchmaker/dataproviders/hu_obi.py

Summary

Maintainability
D
2 days
Test Coverage

Function process has a Cognitive Complexity of 17 (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_obi.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

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

    def constains(self):
        self.link = 'https://www.obi.hu/storeLocatorRest/v1/stores/getAllByCountry/hu/hu?fields=name,address,phone,services,hours,storeNumber,path,email'
        self.tags = {'shop': 'doityourself', 'brand': 'OBI', 'brand:wikidata': 'Q300518',
                     'brand:wikipedia': 'en:Obi (store)', 'operator': 'OBI Hungary Retail Kft.',
                     'operator:addr': '1097 Budapest, Könyves Kálmán körút 12-14',
Severity: Major
Found in osm_poi_matchmaker/dataproviders/hu_obi.py and 2 other locations - About 3 hrs to fix
osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 22..30
osm_poi_matchmaker/dataproviders/hu_takko.py on lines 24..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 73.

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

try:
    import logging
    import sys
    import os
    import json
Severity: Major
Found in osm_poi_matchmaker/dataproviders/hu_obi.py and 4 other locations - About 3 hrs to fix
osm_poi_matchmaker/dataproviders/hu_benu.py on lines 3..19
osm_poi_matchmaker/dataproviders/hu_oil.py on lines 3..19
osm_poi_matchmaker/dataproviders/hu_omv.py on lines 3..19
osm_poi_matchmaker/dataproviders/hu_takko.py on lines 3..19

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

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

    def types(self):
        huobidiy = self.tags.copy()
        huobidiy.update(POS_HU_GEN)
        huobidiy.update(PAY_CASH)
        self.__types = [
Severity: Major
Found in osm_poi_matchmaker/dataproviders/hu_obi.py and 8 other locations - About 3 hrs to fix
osm_poi_matchmaker/dataproviders/hu_dm.py on lines 36..46
osm_poi_matchmaker/dataproviders/hu_jysk.py on lines 35..45
osm_poi_matchmaker/dataproviders/hu_oil.py on lines 36..46
osm_poi_matchmaker/dataproviders/hu_omv.py on lines 43..53
osm_poi_matchmaker/dataproviders/hu_penny_market.py on lines 37..46
osm_poi_matchmaker/dataproviders/hu_pepco.py on lines 36..46
osm_poi_matchmaker/dataproviders/hu_rossmann.py on lines 40..49
osm_poi_matchmaker/dataproviders/hu_yves_rocher.py on lines 37..48

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

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 'email' in poi_data and poi_data.get('email') != '':
                        self.data.email = clean_email(poi_data.get('email'))
Severity: Major
Found in osm_poi_matchmaker/dataproviders/hu_obi.py and 1 other location - About 1 hr to fix
osm_poi_matchmaker/dataproviders/hu_obi.py on lines 62..64

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

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 'phone' in poi_data and poi_data.get('phone') != '':
                        self.data.phone = clean_phone_to_str(
                            poi_data.get('phone'))
Severity: Major
Found in osm_poi_matchmaker/dataproviders/hu_obi.py and 1 other location - About 1 hr to fix
osm_poi_matchmaker/dataproviders/hu_obi.py on lines 67..68

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

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['address']['lat'],
                                                                     poi_data['address']['lon'])
Severity: Major
Found in osm_poi_matchmaker/dataproviders/hu_obi.py and 3 other locations - About 1 hr to fix
osm_poi_matchmaker/dataproviders/hu_mobil_petrol.py on lines 61..62
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

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_obi.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_mobil_petrol.py on lines 49..50
osm_poi_matchmaker/dataproviders/hu_mol_bubi.py on lines 42..43
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