wikimedia/pywikibot

View on GitHub

Showing 161 of 736 total issues

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

        'sv': lambda v: dh(v, '%d000-talet f.Kr. (millennium)',
                           lambda i: i - 1, lambda ii: ii[0] + 1),
Severity: Major
Found in pywikibot/date.py and 4 other locations - About 50 mins to fix
pywikibot/date.py on lines 1172..1173
pywikibot/date.py on lines 1242..1243
pywikibot/date.py on lines 1289..1291
pywikibot/date.py on lines 1339..1340

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

        'sv': lambda v: dh(v, '%d00-talet f.Kr.',
                           lambda i: i - 1, lambda ii: ii[0] + 1),
Severity: Major
Found in pywikibot/date.py and 4 other locations - About 50 mins to fix
pywikibot/date.py on lines 1172..1173
pywikibot/date.py on lines 1289..1291
pywikibot/date.py on lines 1339..1340
pywikibot/date.py on lines 1394..1395

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

        'sv': lambda v: dh(v, '%d000-talet (millennium)',
                           lambda i: i - 1, lambda ii: ii[0] + 1),
Severity: Major
Found in pywikibot/date.py and 4 other locations - About 50 mins to fix
pywikibot/date.py on lines 1172..1173
pywikibot/date.py on lines 1242..1243
pywikibot/date.py on lines 1289..1291
pywikibot/date.py on lines 1394..1395

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

            (lambda v: dh(v, '%d000-vuosituhat',
                          lambda i: i - 1,
                          lambda ii: ii[0] + 1),
Severity: Major
Found in pywikibot/date.py and 4 other locations - About 50 mins to fix
pywikibot/date.py on lines 1172..1173
pywikibot/date.py on lines 1242..1243
pywikibot/date.py on lines 1339..1340
pywikibot/date.py on lines 1394..1395

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

        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

        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

        'sv': lambda v: dh(v, '%d00-talet',
                           lambda i: i - 1, lambda ii: ii[0] + 1),
Severity: Major
Found in pywikibot/date.py and 4 other locations - About 50 mins to fix
pywikibot/date.py on lines 1242..1243
pywikibot/date.py on lines 1289..1291
pywikibot/date.py on lines 1339..1340
pywikibot/date.py on lines 1394..1395

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

            if not self.sametitle(pagedata['title'],
                                  page.title(with_section=False)):
                raise InconsistentTitleError(page, pagedata['title'])
Severity: Major
Found in pywikibot/site/_generators.py and 2 other locations - About 45 mins to fix
pywikibot/site/_apisite.py on lines 1437..1439
pywikibot/site/_extensions.py on lines 237..239

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

            if not self.sametitle(pageitem['title'],
                                  page.title(with_section=False)):
                raise InconsistentTitleError(page, pageitem['title'])
Severity: Major
Found in pywikibot/site/_extensions.py and 2 other locations - About 45 mins to fix
pywikibot/site/_apisite.py on lines 1437..1439
pywikibot/site/_generators.py on lines 828..830

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

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

            if not self.sametitle(pageitem['title'],
                                  page.title(with_section=False)):
                raise InconsistentTitleError(page, pageitem['title'])
Severity: Major
Found in pywikibot/site/_apisite.py and 2 other locations - About 45 mins to fix
pywikibot/site/_extensions.py on lines 237..239
pywikibot/site/_generators.py on lines 828..830

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

    def double_redirects(
        self,
        total: int | None = None,
    ) -> Iterable[pywikibot.Page]:
        """Yield Pages with double redirects from Special:DoubleRedirects.
Severity: Major
Found in pywikibot/site/_generators.py and 16 other locations - About 30 mins to fix
pywikibot/site/_generators.py on lines 2098..2106
pywikibot/site/_generators.py on lines 2123..2131
pywikibot/site/_generators.py on lines 2133..2141
pywikibot/site/_generators.py on lines 2143..2151
pywikibot/site/_generators.py on lines 2153..2161
pywikibot/site/_generators.py on lines 2163..2171
pywikibot/site/_generators.py on lines 2173..2181
pywikibot/site/_generators.py on lines 2183..2191
pywikibot/site/_generators.py on lines 2193..2201
pywikibot/site/_generators.py on lines 2206..2214
pywikibot/site/_generators.py on lines 2216..2224
pywikibot/site/_generators.py on lines 2226..2234
pywikibot/site/_generators.py on lines 2236..2244
pywikibot/site/_generators.py on lines 2246..2254
pywikibot/site/_generators.py on lines 2256..2264
pywikibot/site/_generators.py on lines 2276..2284

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

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

    def uncategorizedcategories(
        self,
        total: int | None = None,
    ) -> Iterable[pywikibot.Page]:
        """Yield Categories from Special:Uncategorizedcategories.
Severity: Major
Found in pywikibot/site/_generators.py and 16 other locations - About 30 mins to fix
pywikibot/site/_generators.py on lines 2098..2106
pywikibot/site/_generators.py on lines 2123..2131
pywikibot/site/_generators.py on lines 2133..2141
pywikibot/site/_generators.py on lines 2143..2151
pywikibot/site/_generators.py on lines 2153..2161
pywikibot/site/_generators.py on lines 2163..2171
pywikibot/site/_generators.py on lines 2173..2181
pywikibot/site/_generators.py on lines 2193..2201
pywikibot/site/_generators.py on lines 2206..2214
pywikibot/site/_generators.py on lines 2216..2224
pywikibot/site/_generators.py on lines 2226..2234
pywikibot/site/_generators.py on lines 2236..2244
pywikibot/site/_generators.py on lines 2246..2254
pywikibot/site/_generators.py on lines 2256..2264
pywikibot/site/_generators.py on lines 2266..2274
pywikibot/site/_generators.py on lines 2276..2284

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

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

Severity
Category
Status
Source
Language