Showing 268 of 272 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 949 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 655 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def focus_prev_sibling(self):
                  """
                  focus previous sibling of currently focussed message in thread tree
                  """
                  mid = self.get_selected_mid()
          Severity: Major
          Found in alot/buffers/thread.py and 1 other location - About 7 hrs to fix
          alot/buffers/thread.py on lines 256..267

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 112.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def focus_prev(self):
                  """focus previous message in depth first order"""
                  mid = self.get_selected_mid()
                  localroot = self._sanitize_position((mid,))
                  if localroot == self.get_focus()[1]:
          Severity: Major
          Found in alot/buffers/thread.py and 1 other location - About 7 hrs to fix
          alot/buffers/thread.py on lines 233..246

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 112.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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 manager.py has 446 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 helper.py has 441 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 6 hrs to fix

              File utils.py has 430 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

                    File manager.py has 353 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 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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language