Showing 151 of 275 total issues

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

    def complete(self, original, pos):
        if not self.abooks:
            return []
        prefix = original[:pos]
        res = []
Severity: Minor
Found in alot/completion/abooks.py - About 45 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

Avoid deeply nested control flow statements.
Open

                        if header.lower() in ['to', 'cc', 'bcc']:
                            res = self._contactscompleter.complete(params,
                                                                   localpos)
                        elif header.lower() == 'from':
                            res = self._accountscompleter.complete(params,
Severity: Major
Found in alot/completion/command.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                if cmd == 'toggle':
                                    presenttags = self.collect_tags(querystring)
                                    to_remove = []
                                    to_add = []
                                    for tag in tags:
    Severity: Major
    Found in alot/db/manager.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  with msg.frozen():
                                      logging.debug('freeze')
                                      for tag in tags:
                                          msg.tags.add(tag)
                                      if sync:
      Severity: Major
      Found in alot/db/manager.py - About 45 mins to fix

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

            def rebuild(self):
                if self.isinitialized:
                    focusposition = self.bufferlist.get_focus()[1]
                else:
                    focusposition = 0
        Severity: Minor
        Found in alot/buffers/bufferlist.py - About 45 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 refresh has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def refresh():
                    # update total result count
                    if not self.allm:
                        # remove thread from resultset if it doesn't match the search query
                        # any more and refresh selected threadline otherwise
        Severity: Minor
        Found in alot/commands/search.py - About 45 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

        Avoid deeply nested control flow statements.
        Open

                                if name:
                                    ui.notify('saved %s as: %s' % (name, dest))
                                else:
                                    ui.notify('saved attachment as: %s' % dest)
                        else:
        Severity: Major
        Found in alot/commands/thread.py - About 45 mins to fix

          Function _handle_signatures has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def _handle_signatures(original_bytes, original, message, params):
              """Shared code for handling message signatures.
          
              RFC 3156 is quite strict:
              * exactly two messages
          Severity: Minor
          Found in alot/db/utils.py - About 45 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 __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, path, spawn=None, thread=None, **kwargs):
                  """
                  :param path: path to the file to be edited
                  :type path: str
                  :param spawn: force running edtor in a new terminal
          Severity: Minor
          Found in alot/commands/globals.py - About 45 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

          Avoid deeply nested control flow statements.
          Open

                                  for value in mail.get_all(key):
                                      dvalue = decode_header(value, normalize=normalize)
                                      lines.append((key, dvalue))
                          elif key.lower() == 'tags':
          Severity: Major
          Found in alot/widgets/thread.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if t is not tagrep['translated']:
                                        t = '%s (%s)' % (tagrep['translated'], t)
                                    values.append(t)
            Severity: Major
            Found in alot/widgets/thread.py - About 45 mins to fix

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

                  def __init__(self, choices, callback, cancel=None, select=None,
              Severity: Minor
              Found in alot/widgets/globals.py - About 45 mins to fix

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

                    def __init__(self, commandline, regex, reflags=0,
                Severity: Minor
                Found in alot/addressbook/external.py - About 35 mins to fix

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

                      def __init__(self, message=None, all=False, listreply=None, spawn=None,
                  Severity: Minor
                  Found in alot/commands/thread.py - About 35 mins to fix

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

                        def __init__(self, tags='', action='add', all=False, flush=True,
                    Severity: Minor
                    Found in alot/commands/thread.py - About 35 mins to fix

                      Function get_key has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def get_key(keyid, validate=False, encrypt=False, sign=False,
                      Severity: Minor
                      Found in alot/crypto.py - About 35 mins to fix

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

                            def __init__(self, tags='', action='add', allmessages=False, flush=True,
                        Severity: Minor
                        Found in alot/commands/search.py - About 35 mins to fix

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

                              def __init__(self, envelope=None, spawn=None, refocus=True, part=None,
                          Severity: Minor
                          Found in alot/commands/envelope.py - About 35 mins to fix

                            Function prompt has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def prompt(self, prefix, text='', completer=None, tab=0, history=None):
                            Severity: Minor
                            Found in alot/ui.py - About 35 mins to fix

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

                                  def __init__(self, all=False, separately=False, raw=False, add_tags=False,
                              Severity: Minor
                              Found in alot/commands/thread.py - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language