Showing 151 of 275 total issues

Function pretty_datetime has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def pretty_datetime(d):
    """
    translates :class:`datetime` `d` to a "sup-style" human readable string.

    >>> now = datetime.now()
Severity: Minor
Found in alot/helper.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 apply has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def apply(self, ui):
        logging.debug(self.movement)
        original_focus = ui.get_deep_focus()
        tbuffer = ui.current_buffer
        if self.movement == 'parent':
Severity: Minor
Found in alot/commands/thread.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 __init__ has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, cmd, all=False, separately=False, background=False,
Severity: Major
Found in alot/commands/thread.py - About 1 hr to fix

    Function get_tagstring_representation has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_tagstring_representation(self, tag, onebelow_normal=None,
                                         onebelow_focus=None):
            """
            looks up user's preferred way to represent a given tagstring.
    
    
    Severity: Minor
    Found in alot/settings/manager.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 main has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def main():
        """The main entry point to alot.  It parses the command line and prepares
        for the user interface main loop to run."""
        options, command = parser()
    
    
    Severity: Minor
    Found in alot/__main__.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 mimewrap has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def mimewrap(path, filename=None, ctype=None):
        """Take the contents of the given path and wrap them into an email MIME
        part according to the content type.  The content type is auto detected from
        the actual file contents and the file name if it is not given.
    
    
    Severity: Minor
    Found in alot/helper.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 __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in alot/db/envelope.py - About 1 hr to fix

      Function _call_and_parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _call_and_parse(self, commandline):
              cmdlist = split_commandstring(commandline)
              resultstring, errmsg, retval = call_cmd(cmdlist)
              if retval != 0:
                  msg = 'abook command "%s" returned with ' % commandline
      Severity: Minor
      Found in alot/addressbook/external.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 string_sanitize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def string_sanitize(string, tab_width=8):
          r"""
          strips, and replaces non-printable characters
      
          :param tab_width: number of spaces to replace tabs with. Read from
      Severity: Minor
      Found in alot/helper.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 _get_at_pos has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_at_pos(self, pos):
              if pos < 0:  # pos too low
                  return (None, None)
              elif pos > len(self.lines):  # pos too high
                  return (None, None)
      Severity: Minor
      Found in alot/walker.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 read_notmuch_config has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def read_notmuch_config(path):
          """
          Read notmuch configuration.
      
          This function calls the command "notmuch --config {path} config list" and
      Severity: Minor
      Found in alot/settings/utils.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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, option_strings, dest=None, nargs=None, default=None,
      Severity: Major
      Found in alot/utils/argparse.py - About 1 hr to fix

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

            def complete(self, original, pos):
                mypart, start, end, mypos = self.relevant_part(original, pos)
                myprefix = mypart[:mypos]
                m = re.search(r'(tag|is|to|from|query):(\w*)', myprefix)
                if m:
        Severity: Minor
        Found in alot/completion/query.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 __init__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, path):
                """
                :param path: path to theme file
                :type path: str
                :raises: :class:`~alot.settings.errors.ConfigError`
        Severity: Minor
        Found in alot/settings/theme.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 parse_mailto has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def parse_mailto(mailto_str):
            """
            Interpret mailto-string
        
            :param mailto_str: the string to interpret. Must conform to :rfc:2368.
        Severity: Minor
        Found in alot/helper.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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, cmd, stdin=None, shell=False, spawn=False,
        Severity: Major
        Found in alot/commands/globals.py - About 1 hr to fix

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

              def __init__(self, query=None, visible=None, raw=None, all_headers=None,
          Severity: Major
          Found in alot/commands/thread.py - About 1 hr to fix

            Function notify has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def notify(self, message, priority='normal', timeout=0, block=False):
                    """
                    opens notification popup.
            
                    :param message: message to print
            Severity: Minor
            Found in alot/ui.py - About 55 mins 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 parse_chart has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def parse_chart(chart, convert):
                """
                Convert string chart into text markup with the correct attributes.
            
                chart -- palette chart as a string
            Severity: Minor
            Found in extra/colour_picker.py - About 55 mins 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_keybinding has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

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