okfn-brasil/serenata-de-amor

View on GitHub
research/src/group_receipts.py

Summary

Maintainability
A
35 mins
Test Coverage

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

        dates = sorted(set([l[0] for l in matches if l]), reverse=True)
Severity: Minor
Found in research/src/group_receipts.py and 2 other locations - About 35 mins to fix
research/src/fetch_foursquare_info.py on lines 25..25
research/src/fetch_yelp_info.py on lines 51..51

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

Invalid escape sequence '\d'
Open

        date_regex = re.compile('\d{4}-\d{2}-\d{2}')
Severity: Minor
Found in research/src/group_receipts.py by pep8

Invalid escape sequences are deprecated in Python 3.6.

Okay: regex = r'\.png$'
W605: regex = '\.png$'

Invalid escape sequence '\d'
Open

        date_regex = re.compile('\d{4}-\d{2}-\d{2}')
Severity: Minor
Found in research/src/group_receipts.py by pep8

Invalid escape sequences are deprecated in Python 3.6.

Okay: regex = r'\.png$'
W605: regex = '\.png$'

Invalid escape sequence '\d'
Open

        date_regex = re.compile('\d{4}-\d{2}-\d{2}')
Severity: Minor
Found in research/src/group_receipts.py by pep8

Invalid escape sequences are deprecated in Python 3.6.

Okay: regex = r'\.png$'
W605: regex = '\.png$'

Ambiguous variable name 'l'
Open

        dates = sorted(set([l[0] for l in matches if l]), reverse=True)
Severity: Minor
Found in research/src/group_receipts.py by pep8

Never use the characters 'l', 'O', or 'I' as variable names.

In some fonts, these characters are indistinguishable from the
numerals one and zero. When tempted to use 'l', use 'L' instead.

Okay: L = 0
Okay: o = 123
Okay: i = 42
E741: l = 0
E741: O = 123
E741: I = 42

Variables can be bound in several other contexts, including class
and function definitions, 'global' and 'nonlocal' statements,
exception handlers, and 'with' and 'for' statements.
In addition, we have a special handling for function parameters.

Okay: except AttributeError as o:
Okay: with lock as L:
Okay: foo(l=12)
Okay: for a in foo(l=12):
E741: except AttributeError as O:
E741: with lock as l:
E741: global I
E741: nonlocal l
E741: def foo(l):
E741: def foo(l=12):
E741: l = foo(l=12)
E741: for l in range(10):
E742: class I(object):
E743: def l(x):

There are no issues that match your filters.

Category
Status