Showing 732 of 732 total issues
File _apisite.py
has 2568 lines of code (exceeds 900 allowed). Consider refactoring. Open
"""Objects representing API interface to MediaWiki site."""
#
# (C) Pywikibot team, 2008-2024
#
# Distributed under the terms of the MIT license.
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
#
File _generators.py
has 2031 lines of code (exceeds 900 allowed). Consider refactoring. Open
"""Objects representing API generators to MediaWiki site."""
#
# (C) Pywikibot team, 2008-2024
#
# Distributed under the terms of the MIT license.
File _wikibase.py
has 1998 lines of code (exceeds 900 allowed). Consider refactoring. Open
"""
Objects representing various types of Wikibase pages and structures.
This module also includes objects:
File site_generators_tests.py
has 1915 lines of code (exceeds 900 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""Tests for generators of the site module."""
#
# (C) Pywikibot team, 2008-2024
#
File interwiki.py
has 1870 lines of code (exceeds 900 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""
Script to check language links for general pages.
Uses existing translations of a page, plus hints from the command line, to
File _basepage.py
has 1868 lines of code (exceeds 900 allowed). Consider refactoring. Open
"""Objects representing a base object for a MediaWiki page."""
#
# (C) Pywikibot team, 2008-2024
#
# Distributed under the terms of the MIT license.
File bot.py
has 1827 lines of code (exceeds 900 allowed). Consider refactoring. Open
"""User-interface related functions for building bots.
This module supports several different bot classes which could be used in
conjunction. Each bot should subclass at least one of these four classes:
Function _upload
has a Cognitive Complexity of 140 (exceeds 10 allowed). Consider refactoring. Open
def _upload(self, ignore_warnings, report_success,
file_key=None, offset=0) -> bool:
"""Recursive Upload method.
:param file_key: Reuses an already uploaded file using the
- Read upRead up
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
File textlib.py
has 1678 lines of code (exceeds 900 allowed). Consider refactoring. Open
"""Functions for manipulating wiki-text."""
#
# (C) Pywikibot team, 2008-2024
#
# Distributed under the terms of the MIT license.
File date.py
has 1677 lines of code (exceeds 900 allowed). Consider refactoring. Open
"""Date data and manipulation module."""
#
# (C) Pywikibot team, 2003-2024
#
# Distributed under the terms of the MIT license.
Function remove_templates
has a Cognitive Complexity of 124 (exceeds 10 allowed). Consider refactoring. Open
def remove_templates(self):
"""Understand if the page is blocked has the right template."""
def understand_block():
"""Understand if the page is blocked has the right template."""
- Read upRead up
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
File pagegenerators_tests.py
has 1461 lines of code (exceeds 900 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""Test pagegenerators module."""
#
# (C) Pywikibot team, 2009-2024
#
File textlib_tests.py
has 1408 lines of code (exceeds 900 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""Test textlib module."""
#
# (C) Pywikibot team, 2011-2024
#
Function review_hunks
has a Cognitive Complexity of 90 (exceeds 10 allowed). Consider refactoring. Open
def review_hunks(self) -> None:
"""Review hunks."""
def find_pending(start: int, end: int) -> int | None:
step = -1 if start > end else +1
for pending in range(start, end, step):
- Read upRead up
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
File category.py
has 1360 lines of code (exceeds 900 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""Script to manage categories.
Syntax:
File checkimages.py
has 1353 lines of code (exceeds 900 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""Script to check recently uploaded files.
This script checks if a file description is present and if there are
other problems in the image's description.
Similar blocks of code found in 3 locations. Consider refactoring. Open
class TestPartiallyQualifiedImplicitLinkDifferentFamilyParser(LinkTestCase):
"""Test partially qualified links to different family."""
family = 'wikipedia'
- Read upRead up
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 175.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
class TestFullyQualifiedOneSiteFamilyExplicitLinkParser(LinkTestCase):
"""Test links to one site target family."""
family = 'species'
- Read upRead up
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 175.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
class TestPartiallyQualifiedExplicitLinkDifferentFamilyParser(LinkTestCase):
"""Link tests."""
family = 'wikipedia'
- Read upRead up
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 175.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76