KarrLab/obj_tables

View on GitHub
examples/address_book/tutorial.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function run has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def run():
    #########################
    # import schema
    import schema as address_book
    PersonType = address_book.Person.type.enum_class
Severity: Minor
Found in examples/address_book/tutorial.py - About 1 hr to fix

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

        facebook = address_book.Company(name='Facebook',
                                        url='https://www.facebook.com/',
                                        address=address_book.Address(street='1 Hacker Way #15',
    Severity: Major
    Found in examples/address_book/tutorial.py and 3 other locations - About 1 hr to fix
    examples/address_book/tutorial.py on lines 9..11
    examples/address_book/tutorial.py on lines 22..24
    examples/address_book/tutorial.py on lines 29..31

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

    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

        google = address_book.Company(name='Google',
                                      url='https://www.google.com/',
                                      address=address_book.Address(street='1600 Amphitheatre Pkwy',
    Severity: Major
    Found in examples/address_book/tutorial.py and 3 other locations - About 1 hr to fix
    examples/address_book/tutorial.py on lines 9..11
    examples/address_book/tutorial.py on lines 16..18
    examples/address_book/tutorial.py on lines 29..31

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

    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

        apple = address_book.Company(name='Apple',
                                     url='https://www.apple.com/',
                                     address=address_book.Address(street='10600 N Tantau Ave',
    Severity: Major
    Found in examples/address_book/tutorial.py and 3 other locations - About 1 hr to fix
    examples/address_book/tutorial.py on lines 16..18
    examples/address_book/tutorial.py on lines 22..24
    examples/address_book/tutorial.py on lines 29..31

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

    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

        netflix = address_book.Company(name='Netflix',
                                       url='https://www.netflix.com/',
                                       address=address_book.Address(street='100 Winchester Cir',
    Severity: Major
    Found in examples/address_book/tutorial.py and 3 other locations - About 1 hr to fix
    examples/address_book/tutorial.py on lines 9..11
    examples/address_book/tutorial.py on lines 16..18
    examples/address_book/tutorial.py on lines 22..24

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

    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

        hastings = address_book.Person(name='Reed Hastings',
                                       type=PersonType.business,
                                       company=netflix,
                                       email_address='reed.hastings@netflix.com',
                                       phone_number='408-540-3700',
    Severity: Major
    Found in examples/address_book/tutorial.py and 3 other locations - About 30 mins to fix
    examples/address_book/tutorial.py on lines 40..45
    examples/address_book/tutorial.py on lines 52..57
    examples/address_book/tutorial.py on lines 58..63

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

    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

        zuckerberg = address_book.Person(name='Mark Zuckerberg',
                                         type=PersonType.family,
                                         company=facebook,
                                         email_address='zuck@fb.com',
                                         phone_number='650-543-4800',
    Severity: Major
    Found in examples/address_book/tutorial.py and 3 other locations - About 30 mins to fix
    examples/address_book/tutorial.py on lines 40..45
    examples/address_book/tutorial.py on lines 46..51
    examples/address_book/tutorial.py on lines 52..57

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

    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

        cook = address_book.Person(name='Tim Cook',
                                   type=PersonType.business,
                                   company=apple,
                                   email_address='tcook@apple.com',
                                   phone_number='408-996-1010',
    Severity: Major
    Found in examples/address_book/tutorial.py and 3 other locations - About 30 mins to fix
    examples/address_book/tutorial.py on lines 46..51
    examples/address_book/tutorial.py on lines 52..57
    examples/address_book/tutorial.py on lines 58..63

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

    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

        pichai = address_book.Person(name='Sundar Pichai',
                                     type=PersonType.business,
                                     company=google,
                                     email_address='sundar@google.com',
                                     phone_number='650-253-0000',
    Severity: Major
    Found in examples/address_book/tutorial.py and 3 other locations - About 30 mins to fix
    examples/address_book/tutorial.py on lines 40..45
    examples/address_book/tutorial.py on lines 46..51
    examples/address_book/tutorial.py on lines 58..63

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

    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