wikimedia/pywikibot

View on GitHub
tests/wbtypes_tests.py

Summary

Maintainability
C
1 day
Test Coverage

Function test_WbTime_normalization has 37 lines of code (exceeds 30 allowed). Consider refactoring.
Open

    def test_WbTime_normalization(self):
        """Test WbTime normalization."""
        repo = self.get_repo()
        # flake8 is being annoying, so to reduce line length, I'll make
        # some aliases here
Severity: Minor
Found in tests/wbtypes_tests.py - About 1 hr to fix

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

            t5 = pywikibot.WbTime(site=repo, year=2010, month=1, day=1, hour=12,
                                  minute=43, second=12,
                                  precision=pywikibot.WbTime.PRECISION['day'])
    Severity: Major
    Found in tests/wbtypes_tests.py and 5 other locations - About 50 mins to fix
    tests/wbtypes_tests.py on lines 264..266
    tests/wbtypes_tests.py on lines 267..269
    tests/wbtypes_tests.py on lines 270..272
    tests/wbtypes_tests.py on lines 276..278
    tests/wbtypes_tests.py on lines 279..281

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

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

            t4 = pywikibot.WbTime(site=repo, year=2010, month=1, day=1, hour=12,
                                  minute=43, second=12,
                                  precision=pywikibot.WbTime.PRECISION['hour'])
    Severity: Major
    Found in tests/wbtypes_tests.py and 5 other locations - About 50 mins to fix
    tests/wbtypes_tests.py on lines 264..266
    tests/wbtypes_tests.py on lines 267..269
    tests/wbtypes_tests.py on lines 273..275
    tests/wbtypes_tests.py on lines 276..278
    tests/wbtypes_tests.py on lines 279..281

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

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

            t7 = pywikibot.WbTime(site=repo, year=2010, month=1, day=1, hour=12,
                                  minute=43, second=12,
                                  precision=pywikibot.WbTime.PRECISION['year'])
    Severity: Major
    Found in tests/wbtypes_tests.py and 5 other locations - About 50 mins to fix
    tests/wbtypes_tests.py on lines 264..266
    tests/wbtypes_tests.py on lines 267..269
    tests/wbtypes_tests.py on lines 270..272
    tests/wbtypes_tests.py on lines 273..275
    tests/wbtypes_tests.py on lines 276..278

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

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

            t2 = pywikibot.WbTime(site=repo, year=2010, month=1, day=1, hour=12,
                                  minute=43, second=12,
                                  precision=pywikibot.WbTime.PRECISION['second'])
    Severity: Major
    Found in tests/wbtypes_tests.py and 5 other locations - About 50 mins to fix
    tests/wbtypes_tests.py on lines 267..269
    tests/wbtypes_tests.py on lines 270..272
    tests/wbtypes_tests.py on lines 273..275
    tests/wbtypes_tests.py on lines 276..278
    tests/wbtypes_tests.py on lines 279..281

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

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

            t6 = pywikibot.WbTime(site=repo, year=2010, month=1, day=1, hour=12,
                                  minute=43, second=12,
                                  precision=pywikibot.WbTime.PRECISION['month'])
    Severity: Major
    Found in tests/wbtypes_tests.py and 5 other locations - About 50 mins to fix
    tests/wbtypes_tests.py on lines 264..266
    tests/wbtypes_tests.py on lines 267..269
    tests/wbtypes_tests.py on lines 270..272
    tests/wbtypes_tests.py on lines 273..275
    tests/wbtypes_tests.py on lines 279..281

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

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

            t3 = pywikibot.WbTime(site=repo, year=2010, month=1, day=1, hour=12,
                                  minute=43, second=12,
                                  precision=pywikibot.WbTime.PRECISION['minute'])
    Severity: Major
    Found in tests/wbtypes_tests.py and 5 other locations - About 50 mins to fix
    tests/wbtypes_tests.py on lines 264..266
    tests/wbtypes_tests.py on lines 270..272
    tests/wbtypes_tests.py on lines 273..275
    tests/wbtypes_tests.py on lines 276..278
    tests/wbtypes_tests.py on lines 279..281

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

    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

            ts1 = pywikibot.Timestamp(
                year=2022, month=12, day=21, hour=13,
                tzinfo=datetime.timezone(datetime.timedelta(hours=-5)))
    Severity: Major
    Found in tests/wbtypes_tests.py and 4 other locations - About 45 mins to fix
    tests/wbtypes_tests.py on lines 414..416
    tests/wbtypes_tests.py on lines 499..501
    tests/wbtypes_tests.py on lines 523..525
    tests/wbtypes_tests.py on lines 532..534

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

    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

            ts1 = pywikibot.Timestamp(
                year=2022, month=12, day=21, hour=13,
                tzinfo=datetime.timezone(datetime.timedelta(hours=-5)))
    Severity: Major
    Found in tests/wbtypes_tests.py and 4 other locations - About 45 mins to fix
    tests/wbtypes_tests.py on lines 484..486
    tests/wbtypes_tests.py on lines 499..501
    tests/wbtypes_tests.py on lines 523..525
    tests/wbtypes_tests.py on lines 532..534

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

    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

            ts4 = pywikibot.Timestamp(
                year=2023, month=12, day=21, hour=13,
                tzinfo=datetime.timezone(datetime.timedelta(hours=-6)))
    Severity: Major
    Found in tests/wbtypes_tests.py and 4 other locations - About 45 mins to fix
    tests/wbtypes_tests.py on lines 414..416
    tests/wbtypes_tests.py on lines 484..486
    tests/wbtypes_tests.py on lines 499..501
    tests/wbtypes_tests.py on lines 523..525

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

    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

            ts1 = pywikibot.Timestamp(
                year=2023, month=12, day=21, hour=13,
                tzinfo=datetime.timezone(datetime.timedelta(hours=-5)))
    Severity: Major
    Found in tests/wbtypes_tests.py and 4 other locations - About 45 mins to fix
    tests/wbtypes_tests.py on lines 414..416
    tests/wbtypes_tests.py on lines 484..486
    tests/wbtypes_tests.py on lines 499..501
    tests/wbtypes_tests.py on lines 532..534

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

    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

            ts1 = pywikibot.Timestamp(
                year=2023, month=12, day=21, hour=13,
                tzinfo=datetime.timezone(datetime.timedelta(hours=-5)))
    Severity: Major
    Found in tests/wbtypes_tests.py and 4 other locations - About 45 mins to fix
    tests/wbtypes_tests.py on lines 414..416
    tests/wbtypes_tests.py on lines 484..486
    tests/wbtypes_tests.py on lines 523..525
    tests/wbtypes_tests.py on lines 532..534

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

    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