Showing 271 of 275 total issues

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

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

    cmd.prehook = get_hook('pre_%s_%s' % (mode, cmdname)) or \
        get_hook('pre_global_%s' % cmdname)
Severity: Minor
Found in alot/commands/__init__.py and 1 other location - About 45 mins to fix
alot/commands/__init__.py on lines 204..205

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 35.

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

    cmd.posthook = get_hook('post_%s_%s' % (mode, cmdname)) or \
        get_hook('post_global_%s' % cmdname)
Severity: Minor
Found in alot/commands/__init__.py and 1 other location - About 45 mins to fix
alot/commands/__init__.py on lines 202..203

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 35.

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 __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

    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, 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, 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 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, envelope=None, spawn=None, refocus=True, part=None,
                Severity: Minor
                Found in alot/commands/envelope.py - About 35 mins to fix

                  Function __cmp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __cmp(self, other, comparitor):
                          """Shared helper for rich comparison operators.
                  
                          This allows the comparison operators to be relatively simple and share
                          the complex logic.
                  Severity: Minor
                  Found in alot/account.py - About 35 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 _path_factory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def _path_factory(check):
                      """Create a function that checks paths."""
                  
                      @functools.wraps(check)
                      def validator(paths):
                  Severity: Minor
                  Found in alot/utils/argparse.py - About 35 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def update(self, redraw=True):
                          """redraw interface"""
                          # get the main urwid.Frame widget
                          mainframe = self.root_widget.original_widget
                  
                  
                  Severity: Minor
                  Found in alot/ui.py - About 35 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 attr_triple has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def attr_triple(value):
                      """
                      Check that interprets the value as `urwid.AttrSpec` triple for the colour
                      modes 1,16 and 256.  It assumes a <6 tuple of attribute strings for
                      mono foreground, mono background, 16c fg, 16c bg, 256 fg and 256 bg
                  Severity: Minor
                  Found in alot/utils/configobj.py - About 35 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 apply has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def apply(self, ui):
                          if self.querystring or self.sort_order:
                              sbuffer = ui.current_buffer
                              oldquery = sbuffer.querystring
                              if self.querystring not in [None, oldquery]:
                  Severity: Minor
                  Found in alot/commands/search.py - About 35 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 apply has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def apply(self, ui):
                          if self.buffer is None:
                              if self.index is not None:
                                  try:
                                      self.buffer = ui.buffers[self.index]
                  Severity: Minor
                  Found in alot/commands/globals.py - About 35 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 main has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def main():
                      palette = [
                          ('header', 'black,underline', 'light gray', 'standout,underline',
                              'black,underline', '#88a'),
                          ('panel', 'light gray', 'dark blue', '',
                  Severity: Minor
                  Found in extra/colour_picker.py - About 35 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 unfold_matching has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def unfold_matching(self, querystring, focus_first=True):
                          """
                          expand all messages that match a given querystring.
                  
                          :param querystring: query to match
                  Severity: Minor
                  Found in alot/buffers/thread.py - About 35 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 width_tuple has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def width_tuple(value):
                      """
                      test if value is a valid width indicator (for a sub-widget in a column).
                      This can either be
                      ('fit', min, max): use the length actually needed for the content, padded
                  Severity: Minor
                  Found in alot/utils/configobj.py - About 35 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