Showing 150 of 273 total issues

File globals.py has 998 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (C) 2011-2012  Patrick Totzke <patricktotzke@gmail.com>
# Copyright © 2018 Dylan Baker
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
import argparse
Severity: Major
Found in alot/commands/globals.py - About 2 days to fix

    File thread.py has 947 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # Copyright (C) 2011-2012  Patrick Totzke <patricktotzke@gmail.com>
    # Copyright © 2018 Dylan Baker
    # This file is released under the GNU GPL, version 3 or a later revision.
    # For further details see the COPYING file
    import argparse
    Severity: Major
    Found in alot/commands/thread.py - About 2 days to fix

      Function flush has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
      Open

          def flush(self):
              """
              write out all queued write-commands in order, each one in a separate
              :meth:`atomic <notmuch2.Database.atomic>` transaction.
      
      
      Severity: Minor
      Found in alot/db/manager.py - About 1 day 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

      File envelope.py has 668 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Copyright (C) 2011-2012  Patrick Totzke <patricktotzke@gmail.com>
      # Copyright © 2018 Dylan Baker
      # This file is released under the GNU GPL, version 3 or a later revision.
      # For further details see the COPYING file
      import argparse
      Severity: Major
      Found in alot/commands/envelope.py - About 1 day to fix

        File ui.py has 649 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # Copyright (C) 2011-2012  Patrick Totzke <patricktotzke@gmail.com>
        # This file is released under the GNU GPL, version 3 or a later revision.
        # For further details see the COPYING file
        import logging
        import os
        Severity: Major
        Found in alot/ui.py - About 1 day to fix

          Function complete has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
          Open

              def complete(self, original, pos):
                  # remember how many preceding space characters we see until the command
                  # string starts. We'll continue to complete from there on and will add
                  # these whitespaces again at the very end
                  whitespaceoffset = len(original) - len(original.lstrip())
          Severity: Minor
          Found in alot/completion/command.py - About 1 day 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 keypress has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
          Open

              def keypress(self, size, key):
                  # if we tabcomplete
                  if key in ['tab', 'shift tab'] and self.completer:
                      # if not already in completion mode
                      if self.completions is None:
          Severity: Minor
          Found in alot/widgets/globals.py - About 7 hrs 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

          File helper.py has 461 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          # Copyright (C) 2011-2012  Patrick Totzke <patricktotzke@gmail.com>
          # Copyright © 2017-2018 Dylan Baker
          # This file is released under the GNU GPL, version 3 or a later revision.
          # For further details see the COPYING file
          Severity: Minor
          Found in alot/helper.py - About 7 hrs to fix

            File manager.py has 440 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # Copyright (C) 2011-2012  Patrick Totzke <patricktotzke@gmail.com>
            # This file is released under the GNU GPL, version 3 or a later revision.
            # For further details see the COPYING file
            import importlib.util
            import itertools
            Severity: Minor
            Found in alot/settings/manager.py - About 6 hrs to fix

              File utils.py has 428 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # encoding=utf-8
              # Copyright (C) 2011-2012  Patrick Totzke <patricktotzke@gmail.com>
              # Copyright © 2017 Dylan Baker <dylan@pnwbakers.com>
              # This file is released under the GNU GPL, version 3 or a later revision.
              # For further details see the COPYING file
              Severity: Minor
              Found in alot/db/utils.py - About 6 hrs to fix

                Function _input_filter has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _input_filter(self, keys, raw):
                        """
                        handles keypresses.
                        This function gets triggered directly by class:`urwid.MainLoop`
                        upon user input and is supposed to pass on its `keys` parameter
                Severity: Minor
                Found in alot/ui.py - About 5 hrs 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 apply has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                Open

                    def apply(self, ui):
                        tbuffer = ui.current_buffer
                
                        # set message/reply indentation if changed
                        if self.indent is not None:
                Severity: Minor
                Found in alot/commands/thread.py - About 5 hrs 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 read_config has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                Open

                def read_config(configpath=None, specpath=None, checks=None,
                                report_extra=False):
                    """
                    get a (validated) config object for given config file path.
                
                
                Severity: Minor
                Found in alot/settings/utils.py - About 5 hrs 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

                ThreadBuffer has 38 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class ThreadBuffer(Buffer):
                    """displays a thread as a tree of messages."""
                
                    modename = 'thread'
                
                
                Severity: Minor
                Found in alot/buffers/thread.py - About 5 hrs to fix

                  File thread.py has 360 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # Copyright (C) 2011-2012  Patrick Totzke <patricktotzke@gmail.com>
                  # This file is released under the GNU GPL, version 3 or a later revision.
                  # For further details see the COPYING file
                  """
                  Widgets specific to thread mode
                  Severity: Minor
                  Found in alot/widgets/thread.py - About 4 hrs to fix

                    Function construct_mail has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def construct_mail(self):
                            """
                            Compiles the information contained in this envelope into a
                            :class:`email.Message`.
                            """
                    Severity: Minor
                    Found in alot/db/envelope.py - About 4 hrs 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 construct_header_pile has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def construct_header_pile(self, headers=None, normalize=True):
                            mail = self._message.get_email()
                            lines = []
                    
                            if headers is None:
                    Severity: Minor
                    Found in alot/widgets/thread.py - About 4 hrs 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

                    File manager.py has 344 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # Copyright (C) 2011-2012  Patrick Totzke <patricktotzke@gmail.com>
                    # Copyright © Dylan Baker
                    # This file is released under the GNU GPL, version 3 or a later revision.
                    # For further details see the COPYING file
                    from collections import deque
                    Severity: Minor
                    Found in alot/db/manager.py - About 4 hrs to fix

                      Function parse_escapes_to_urwid has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def parse_escapes_to_urwid(text, default_attr=None, default_attr_focus=None,
                                                 parse_background=True):
                          """This function converts a text with ANSI escape for terminal
                          attributes and returns a list containing each part of text and its
                          corresponding Urwid Attributes object, it also returns a dictionary which
                      Severity: Minor
                      Found in alot/widgets/ansi.py - About 4 hrs 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

                      Message has 29 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Message:
                          """
                          a persistent notmuch message object.
                          It it uses a :class:`~alot.db.DBManager` for cached manipulation
                          and lazy lookups.
                      Severity: Minor
                      Found in alot/db/message.py - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language