wikimedia/pywikibot

View on GitHub

Showing 708 of 708 total issues

Function __init__ has 34 lines of code (exceeds 30 allowed). Consider refactoring.
Open

    def __init__(self, photo_description, photo, filename) -> None:
        """Initializer."""
        for module in (idlelib, tkinter):
            if isinstance(module, ImportError):
                raise module
Severity: Minor
Found in pywikibot/userinterfaces/gui.py - About 1 hr to fix

    Function __init__ has 12 arguments (exceeds 7 allowed). Consider refactoring.
    Open

        def __init__(self, cat_title: str | None, list_title: str | None,
    Severity: Major
    Found in scripts/category.py - About 1 hr to fix

      Function title has 12 arguments (exceeds 7 allowed). Consider refactoring.
      Open

          def title(
      Severity: Major
      Found in pywikibot/page/_basepage.py - About 1 hr to fix

        Function newpages has 12 arguments (exceeds 7 allowed). Consider refactoring.
        Open

            def newpages(
        Severity: Major
        Found in pywikibot/site/_generators.py - About 1 hr to fix

          Function __init__ has 12 arguments (exceeds 7 allowed). Consider refactoring.
          Open

              def __init__(self,
          Severity: Major
          Found in pywikibot/_wbtypes.py - About 1 hr to fix

            Function categorymembers has 12 arguments (exceeds 7 allowed). Consider refactoring.
            Open

                def categorymembers(
            Severity: Major
            Found in pywikibot/site/_generators.py - About 1 hr to fix

              Function __init__ has 12 arguments (exceeds 7 allowed). Consider refactoring.
              Open

                  def __init__(self,
              Severity: Major
              Found in pywikibot/site/_upload.py - About 1 hr to fix

                Function main has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                def main(*args: str) -> None:
                    """
                    Process command line arguments and invoke bot.
                
                    If args is an empty list, sys.argv is used.
                Severity: Minor
                Found in scripts/claimit.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

                Function __iter__ has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    def __iter__(self):
                        """Iterator method."""
                        try:
                            for entry in self.parser:
                                if self.skipping:
                Severity: Minor
                Found in scripts/replace.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

                Function load_page has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    def load_page(self) -> None:
                        """Load the page to be archived and break it up into threads.
                
                        .. versionchanged:: 7.6
                           If `-keep` option is given run through all threads and set
                Severity: Minor
                Found in scripts/archivebot.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

                Function purgepages has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    def purgepages(self, flush=False):
                        """Purge a bulk of page if rate limit exceeded.
                
                        .. versionadded:: 8.0
                        .. versionchanged:: 9.0
                Severity: Minor
                Found in scripts/touch.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

                Function pagelanglinks has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    def pagelanglinks(
                        self,
                        page: pywikibot.Page,
                        *,
                        total: int | None = None,
                Severity: Minor
                Found in pywikibot/site/_generators.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

                Function normalize has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    def normalize(self) -> WbTime:
                        """Normalizes the WbTime object to account for precision.
                
                        Normalization is needed because WbTime objects can have hidden
                        values that affect naive comparisons, such as an object set to
                Severity: Minor
                Found in pywikibot/_wbtypes.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

                Function isDisambig has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    def isDisambig(self) -> bool:
                        """Return True if this is a disambiguation page, False otherwise.
                
                        By default, it uses the Disambiguator extension's result. The
                        identification relies on the presence of the ``__DISAMBIG__``
                Severity: Minor
                Found in pywikibot/page/_basepage.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

                Function __getattr__ has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    def __getattr__(self, name: str):
                        """Delegate undefined methods calls to the Family object.
                
                        .. versionchanged:: 9.0
                           Only delegate to public Family methods which have ``code`` as
                Severity: Minor
                Found in pywikibot/site/_basesite.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

                Function change_base_dir has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                def change_base_dir():
                    """Create a new user directory."""
                    while True:
                        new_base = pywikibot.input('New user directory? ')
                        new_base = os.path.abspath(new_base)
                Severity: Minor
                Found in pywikibot/scripts/generate_user_files.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

                Function _detect_win32_editor has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    def _detect_win32_editor() -> str:
                        """Detect the best Win32 editor."""
                        # Notepad is even worse than our Tkinter editor.
                        unusable_exes = ['notepad.exe',
                                         'py.exe',
                Severity: Minor
                Found in pywikibot/editor.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

                Function _ocr_callback has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    def _ocr_callback(
                        self,
                        cmd_uri: str,
                        parser_func: Callable[[str], str] | None = None,
                        ocr_tool: str | None = None,
                Severity: Minor
                Found in pywikibot/proofreadpage.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

                Function select has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    def select(self,
                               query: str,
                               full_data: bool = False,
                               headers: dict[str, str] | None = None
                               ) -> list[dict[str, str]] | None:
                Severity: Minor
                Found in pywikibot/data/sparql.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

                Function parsevalue has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    def parsevalue(self, datatype: str, values: list[str],
                                   options: dict[str, Any] | None = None,
                                   language: str | None = None,
                                   validate: bool = False) -> list[Any]:
                        """
                Severity: Minor
                Found in pywikibot/site/_datasite.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

                Severity
                Category
                Status
                Source
                Language