Showing 151 of 275 total issues

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

    def apply(self, ui):
        if self.movement in ['up', 'down', 'page up', 'page down']:
            ui.mainloop.process_input([self.movement])
        elif self.movement in ['halfpage down', 'halfpage up']:
            ui.mainloop.process_input(
Severity: Minor
Found in alot/commands/globals.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 build_text_part has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def build_text_part(name, thread, struct):
    """
    create an urwid.Text widget (wrapped in approproate Attributes)
    to display a plain text parts in a threadline.
    create an urwid.Columns widget (wrapped in approproate Attributes)
Severity: Minor
Found in alot/widgets/search.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 rebuild has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def rebuild(self):
        if self.isinitialized:
            focusposition = self.taglist.get_focus()[1]
        else:
            focusposition = 0
Severity: Minor
Found in alot/buffers/taglist.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

Avoid deeply nested control flow statements.
Open

                    if res is False:
                        msg = 'key "%s" in section "%s" is missing.'
                        msg = msg % (key, ', '.join(section_list))
                    else:
                        msg = 'key "%s" in section "%s" failed validation: %s'
Severity: Major
Found in alot/settings/utils.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                for msg in db.messages(querystring):
                                    with msg.frozen():
                                        if cmd == 'toggle':
                                            for tag in to_remove:
                                                msg.tags.discard(tag)
    Severity: Major
    Found in alot/db/manager.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if isinstance(act, (argparse._StoreAction,
                                                  cargparse.BooleanAction)):
                                  optionstring += '='
                              res.append(optionstring)
      Severity: Major
      Found in alot/completion/argparse.py - About 45 mins to fix

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

            def _is_attachment(part, ct_override=None):
                """Takes a mimepart and returns a bool indicating if it's an attachment
        
                Takes an optional argument to override the content type.
                """
        Severity: Minor
        Found in alot/db/message.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 _assemble_structure has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _assemble_structure(self, summary_only=False):
                if summary_only:
                    return [(self._get_summary(), None)]
        
                mainstruct = []
        Severity: Minor
        Found in alot/widgets/thread.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 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, completer, on_exit,
        Severity: Minor
        Found in alot/widgets/globals.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if self._alarm is not None:
                                      self.mainloop.remove_alarm(self._alarm)
                                  self._alarm = self.mainloop.set_alarm_in(
          Severity: Major
          Found in alot/ui.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if settings.get(action + '_force_realname'):
                                    realname = account.realname
                                else:
                                    realname = seen_name
                                if settings.get(action + '_force_address'):
            Severity: Major
            Found in alot/commands/thread.py - About 45 mins to fix

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

                  def __init__(self, txt,
              Severity: Minor
              Found in alot/widgets/ansi.py - About 45 mins to fix

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

                    def __init__(self, cmd, stdin=None, shell=False, spawn=False,
                                 refocus=True, thread=False, on_success=None, **kwargs):
                        """
                        :param cmd: the command to call
                        :type cmd: list or str
                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

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

                    def _set_envelope(self):
                        if self.envelope is None:
                            if self.rest:
                                if self.rest.startswith('mailto'):
                                    self.envelope = mailto_to_envelope(self.rest)
                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

                                        if buf:
                                            if isinstance(buf, EnvelopeBuffer):
                                                available = buf.envelope.headers.keys()
                                                localcompleter = StringlistCompleter(available)
                                                localres = localcompleter.complete(localprefix,
                Severity: Major
                Found in alot/completion/command.py - About 45 mins to fix

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

                      def __init__(self, mode, name, help=None, usage=None,
                  Severity: Minor
                  Found in alot/commands/__init__.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if settings.get(action + '_force_address'):
                                            address = str(account.address)
                                        else:
                                            address = seen_address
                    
                    
                    Severity: Major
                    Found in alot/commands/thread.py - About 45 mins to fix

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

                      def render_part(part, field_key='copiousoutput'):
                          """
                          renders a non-multipart email part into displayable plaintext by piping its
                          payload through an external script. The handler itself is determined by
                          the mailcap entry for this part's ctype.
                      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 choice has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def choice(self, message, choices=None, select=None, cancel=None,
                      Severity: Minor
                      Found in alot/ui.py - About 45 mins to fix

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

                            def buffer_focus(self, buf, redraw=True):
                                """focus given :class:`~alot.buffers.Buffer`."""
                        
                                # call pre_buffer_focus hook
                                prehook = settings.get_hook('pre_buffer_focus')
                        Severity: Minor
                        Found in alot/ui.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

                        Severity
                        Category
                        Status
                        Source
                        Language