KAMI911/osm_poi_matchmaker

View on GitHub
osm_poi_matchmaker/dataproviders/hu_foxpost.py

Summary

Maintainability
C
7 hrs
Test Coverage

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

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

    def constains(self):
        self.link = 'https://cdn.foxpost.hu/foxpost_terminals_extended_v3.json'
        self.tags = {'brand': 'Foxpost', 'operator': 'FoxPost Zrt.',
                     'operator:addr': '3200 Gyöngyös, Batsányi János utca 9.', 'ref:vatin': 'HU25034644',
                     'ref:vatin:hu': '25034644-2-10', 'ref:HU:company': '10 10 020309',
Severity: Major
Found in osm_poi_matchmaker/dataproviders/hu_foxpost.py and 4 other locations - About 4 hrs to fix
osm_poi_matchmaker/dataproviders/hu_penny_market.py on lines 23..35
osm_poi_matchmaker/dataproviders/hu_posta.py on lines 24..36
osm_poi_matchmaker/dataproviders/hu_rossmann.py on lines 26..38
osm_poi_matchmaker/dataproviders/hu_yves_rocher.py on lines 23..35

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

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_foxpost.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_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_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

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

                            opening, closing = clean_opening_hours(
                                poi_data['open'][WeekDaysLongHUUnAccented(i).name.lower()])
Severity: Minor
Found in osm_poi_matchmaker/dataproviders/hu_foxpost.py and 1 other location - About 40 mins to fix
osm_poi_matchmaker/dataproviders/hu_rossmann.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 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

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

                    self.data.lat, self.data.lon = check_hu_boundary(
                        poi_data['geolat'], poi_data['geolng'])
Severity: Major
Found in osm_poi_matchmaker/dataproviders/hu_foxpost.py and 6 other locations - About 35 mins to fix
osm_poi_matchmaker/dataproviders/hu_avia.py on lines 63..64
osm_poi_matchmaker/dataproviders/hu_budapest_bank.py on lines 72..73
osm_poi_matchmaker/dataproviders/hu_mol.py on lines 77..78
osm_poi_matchmaker/dataproviders/hu_nemzetidohanybolt.py on lines 50..51
osm_poi_matchmaker/dataproviders/hu_shell.py on lines 114..115
osm_poi_matchmaker/dataproviders/hu_spar.py on lines 99..100

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

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