wikimedia/pywikibot

View on GitHub
tests/wikibase_tests.py

Summary

Maintainability
F
1 wk
Test Coverage

File wikibase_tests.py has 2108 lines of code (exceeds 900 allowed). Consider refactoring.
Open

#!/usr/bin/env python3
"""Tests for the Wikidata parts of the page module."""
#
# (C) Pywikibot team, 2008-2024
#
Severity: Major
Found in tests/wikibase_tests.py - About 3 days to fix

    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/wikibase_tests.py - About 1 hr to fix

      Function _test_fromPage_noitem has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
      Open

          def _test_fromPage_noitem(self, link):
              """Helper function to test a page without an associated item.
      
              It tests two of the ways to fetch an item:
              1. the Page already has props, which should contain an item id if
      Severity: Minor
      Found in tests/wikibase_tests.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

      TODO found
      Open

              # TODO: These items have inappropriate titles, which should
      Severity: Minor
      Found in tests/wikibase_tests.py by fixme

      TODO found
      Open

              # TODO: This is the assertion that this test should be using:
      Severity: Minor
      Found in tests/wikibase_tests.py by fixme

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

          def test_claim_eq_simple(self):
              """
              Test comparing two claims.
      
              If they have the same property and value, they are equal.
      Severity: Major
      Found in tests/wikibase_tests.py and 2 other locations - About 5 hrs to fix
      tests/wikibase_tests.py on lines 1772..1785
      tests/wikibase_tests.py on lines 1818..1831

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

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

          def test_claim_eq_simple_different_value(self):
              """
              Test comparing two claims.
      
              If they have the same property and different values,
      Severity: Major
      Found in tests/wikibase_tests.py and 2 other locations - About 5 hrs to fix
      tests/wikibase_tests.py on lines 1758..1770
      tests/wikibase_tests.py on lines 1818..1831

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

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

          def test_claim_eq_simple_different_property(self):
              """
              Test comparing two claims.
      
              If they have the same value and different properties,
      Severity: Major
      Found in tests/wikibase_tests.py and 2 other locations - About 5 hrs to fix
      tests/wikibase_tests.py on lines 1758..1770
      tests/wikibase_tests.py on lines 1772..1785

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

      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

          def test_set_math(self):
              """Test setting claim of math type."""
              wikidata = self.get_repo()
              claim = pywikibot.Claim(wikidata, 'P2535')
              self.assertEqual(claim.type, 'math')
      Severity: Major
      Found in tests/wikibase_tests.py and 3 other locations - About 2 hrs to fix
      tests/wikibase_tests.py on lines 1964..1971
      tests/wikibase_tests.py on lines 2001..2008
      tests/wikibase_tests.py on lines 2021..2028

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

      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

          def test_set_website(self):
              """Test setting claim of url type."""
              wikidata = self.get_repo()
              claim = pywikibot.Claim(wikidata, 'P856')
              self.assertEqual(claim.type, 'url')
      Severity: Major
      Found in tests/wikibase_tests.py and 3 other locations - About 2 hrs to fix
      tests/wikibase_tests.py on lines 1992..1999
      tests/wikibase_tests.py on lines 2001..2008
      tests/wikibase_tests.py on lines 2021..2028

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

      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

          def test_set_musical_notation(self):
              """Test setting claim of musical-notation type."""
              wikidata = self.get_repo()
              claim = pywikibot.Claim(wikidata, 'P6604')
              self.assertEqual(claim.type, 'musical-notation')
      Severity: Major
      Found in tests/wikibase_tests.py and 3 other locations - About 2 hrs to fix
      tests/wikibase_tests.py on lines 1964..1971
      tests/wikibase_tests.py on lines 1992..1999
      tests/wikibase_tests.py on lines 2001..2008

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

      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

          def test_set_identifier(self):
              """Test setting claim of external-id type."""
              wikidata = self.get_repo()
              claim = pywikibot.Claim(wikidata, 'P214')
              self.assertEqual(claim.type, 'external-id')
      Severity: Major
      Found in tests/wikibase_tests.py and 3 other locations - About 2 hrs to fix
      tests/wikibase_tests.py on lines 1964..1971
      tests/wikibase_tests.py on lines 1992..1999
      tests/wikibase_tests.py on lines 2021..2028

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

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

          def test_from_entity_uri_wrong_repo(self):
              """Test ItemPage.from_entity_uri with unexpected item repo."""
              repo = self.get_repo()
              entity_uri = 'http://test.wikidata.org/entity/Q124'
              regex = (r'^The supplied data repository \(.+\) does not '
      Severity: Major
      Found in tests/wikibase_tests.py and 2 other locations - About 1 hr to fix
      tests/wikibase_tests.py on lines 1619..1625
      tests/wikibase_tests.py on lines 1627..1633

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

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

          def test_from_entity_uri_invalid_title(self):
              """Test ItemPage.from_entity_uri with an invalid item title format."""
              repo = self.get_repo()
              entity_uri = 'http://www.wikidata.org/entity/Nonsense'
              regex = r"^'.+' is not a valid .+ page title$"
      Severity: Major
      Found in tests/wikibase_tests.py and 2 other locations - About 1 hr to fix
      tests/wikibase_tests.py on lines 1610..1617
      tests/wikibase_tests.py on lines 1627..1633

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

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

          def test_from_entity_uri_no_item(self):
              """Test ItemPage.from_entity_uri with non-existent item."""
              repo = self.get_repo()
              entity_uri = 'http://www.wikidata.org/entity/Q999999999999999999'
              regex = r"^Page .+ doesn't exist\.$"
      Severity: Major
      Found in tests/wikibase_tests.py and 2 other locations - About 1 hr to fix
      tests/wikibase_tests.py on lines 1610..1617
      tests/wikibase_tests.py on lines 1619..1625

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

      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/wikibase_tests.py and 5 other locations - About 50 mins to fix
      tests/wikibase_tests.py on lines 360..362
      tests/wikibase_tests.py on lines 363..365
      tests/wikibase_tests.py on lines 369..371
      tests/wikibase_tests.py on lines 372..374
      tests/wikibase_tests.py on lines 375..377

      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/wikibase_tests.py and 5 other locations - About 50 mins to fix
      tests/wikibase_tests.py on lines 360..362
      tests/wikibase_tests.py on lines 363..365
      tests/wikibase_tests.py on lines 366..368
      tests/wikibase_tests.py on lines 369..371
      tests/wikibase_tests.py on lines 372..374

      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/wikibase_tests.py and 5 other locations - About 50 mins to fix
      tests/wikibase_tests.py on lines 363..365
      tests/wikibase_tests.py on lines 366..368
      tests/wikibase_tests.py on lines 369..371
      tests/wikibase_tests.py on lines 372..374
      tests/wikibase_tests.py on lines 375..377

      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/wikibase_tests.py and 5 other locations - About 50 mins to fix
      tests/wikibase_tests.py on lines 360..362
      tests/wikibase_tests.py on lines 366..368
      tests/wikibase_tests.py on lines 369..371
      tests/wikibase_tests.py on lines 372..374
      tests/wikibase_tests.py on lines 375..377

      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

              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/wikibase_tests.py and 5 other locations - About 50 mins to fix
      tests/wikibase_tests.py on lines 360..362
      tests/wikibase_tests.py on lines 363..365
      tests/wikibase_tests.py on lines 366..368
      tests/wikibase_tests.py on lines 372..374
      tests/wikibase_tests.py on lines 375..377

      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/wikibase_tests.py and 5 other locations - About 50 mins to fix
      tests/wikibase_tests.py on lines 360..362
      tests/wikibase_tests.py on lines 363..365
      tests/wikibase_tests.py on lines 366..368
      tests/wikibase_tests.py on lines 369..371
      tests/wikibase_tests.py on lines 375..377

      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/wikibase_tests.py and 4 other locations - About 45 mins to fix
      tests/wikibase_tests.py on lines 510..512
      tests/wikibase_tests.py on lines 595..597
      tests/wikibase_tests.py on lines 619..621
      tests/wikibase_tests.py on lines 628..630

      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/wikibase_tests.py and 4 other locations - About 45 mins to fix
      tests/wikibase_tests.py on lines 580..582
      tests/wikibase_tests.py on lines 595..597
      tests/wikibase_tests.py on lines 619..621
      tests/wikibase_tests.py on lines 628..630

      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/wikibase_tests.py and 4 other locations - About 45 mins to fix
      tests/wikibase_tests.py on lines 510..512
      tests/wikibase_tests.py on lines 580..582
      tests/wikibase_tests.py on lines 619..621
      tests/wikibase_tests.py on lines 628..630

      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/wikibase_tests.py and 4 other locations - About 45 mins to fix
      tests/wikibase_tests.py on lines 510..512
      tests/wikibase_tests.py on lines 580..582
      tests/wikibase_tests.py on lines 595..597
      tests/wikibase_tests.py on lines 628..630

      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/wikibase_tests.py and 4 other locations - About 45 mins to fix
      tests/wikibase_tests.py on lines 510..512
      tests/wikibase_tests.py on lines 580..582
      tests/wikibase_tests.py on lines 595..597
      tests/wikibase_tests.py on lines 619..621

      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