Showing 150 of 273 total issues

Function rebuild has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def rebuild(self):
        displayed_widgets = []
        hidden = settings.get('envelope_headers_blacklist')
        # build lines
        lines = []
Severity: Minor
Found in alot/buffers/envelope.py - About 3 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 rewrite_entries has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

def rewrite_entries(config, path, specpath, sec=None):
    file = open(path, 'w')
    file.write(NOTE % specpath)

    if sec is None:
Severity: Minor
Found in docs/source/generate_configs.py - About 3 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 globals.py has 307 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

"""
Severity: Minor
Found in alot/widgets/globals.py - About 3 hrs to fix

    Function get_key has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_key(keyid, validate=False, encrypt=False, sign=False,
                signed_only=False):
        """
        Gets a key from the keyring by filtering for the specified keyid, but
        only if the given keyid is specific enough (if it matches multiple
    Severity: Minor
    Found in alot/crypto.py - About 3 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 account.py has 300 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
    # 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/account.py - About 3 hrs to fix

      Function determine_sender has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      def determine_sender(mail, action='reply'):
          """
          Inspect a given mail to reply/forward/bounce and find the most appropriate
          account to act from and construct a suitable From-Header to use.
      
      
      Severity: Minor
      Found in alot/commands/thread.py - About 3 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 envelope.py has 293 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 glob
      import logging
      Severity: Minor
      Found in alot/db/envelope.py - About 3 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                        if all_optionals:
                            myarg = arguments_until_now[-1]
                            start_myarg = params.rindex(myarg)
                            beforeme = params[:start_myarg]
                            # set up local stringlist completer
        Severity: Critical
        Found in alot/completion/command.py - About 3 hrs to fix

          Function rstify_parser has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          def rstify_parser(parser):
              parser.formatter_class = HF
          
              formatter = parser._get_formatter()
              out = ""
          Severity: Minor
          Found in docs/source/generate_commands.py - About 2 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 21 (exceeds 5 allowed). Consider refactoring.
          Open

              def apply(self, ui):
                  sign = None
                  envelope = ui.current_buffer.envelope
                  # sign status
                  if self.action == 'sign':
          Severity: Minor
          Found in alot/commands/envelope.py - About 2 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 thread.py has 284 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # Copyright (C) 2011-2018  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 asyncio
          Severity: Minor
          Found in alot/buffers/thread.py - About 2 hrs to fix

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

                def complete(self, original, pos):
                    pref = original[:pos]
            
                    res = []
                    for act in self.actions:
            Severity: Minor
            Found in alot/completion/argparse.py - About 2 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 shorten_author_string has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            def shorten_author_string(authors_string, maxlength):
                """
                Parse a list of authors concatenated as a text string (comma
                separated) and smartly adjust them to maxlength.
            
            
            Severity: Minor
            Found in alot/helper.py - About 2 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 get_authors_string has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_authors_string(self, own_accts=None, replace_own=None):
                    """
                    returns a string of comma-separated authors
                    Depending on settings, it will substitute "me" for author name if
                    address is user's own.
            Severity: Minor
            Found in alot/db/thread.py - About 2 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

            SettingsManager has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class SettingsManager:
                """Organizes user settings"""
                def __init__(self):
                    self.hooks = None
                    self._mailcaps = mailcap.getcaps()
            Severity: Minor
            Found in alot/settings/manager.py - About 2 hrs to fix

              Function __init__ has 21 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, address=None, aliases=None, alias_regexp=None,
              Severity: Major
              Found in alot/account.py - About 2 hrs to fix

                Function get_authors has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_authors(self):
                        """
                        returns a list of authors (name, addr) of the messages.
                        The authors are ordered by msg date and unique (by name/addr).
                
                
                Severity: Minor
                Found in alot/db/thread.py - About 2 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

                UI has 23 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class UI:
                    """
                    This class integrates all components of alot and offers
                    methods for user interaction like :meth:`prompt`, :meth:`notify` etc.
                    It handles the urwid widget tree and mainloop (we use asyncio) and is
                Severity: Minor
                Found in alot/ui.py - About 2 hrs to fix

                  Function parse_template has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def parse_template(self, raw, reset=False, only_body=False,
                                         target_body='plaintext'):
                          """Parse a template or user edited string to fills this envelope.
                  
                          :param raw: the string to parse.
                  Severity: Minor
                  Found in alot/db/envelope.py - About 2 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 get_keybindings has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get_keybindings(self, mode):
                          """look up keybindings from `MODE-maps` sections
                  
                          :param mode: mode identifier
                          :type mode: str
                  Severity: Minor
                  Found in alot/settings/manager.py - About 2 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

                  Severity
                  Category
                  Status
                  Source
                  Language