Showing 271 of 275 total issues

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

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

          def focus_next_matching(self, querystring):
              """focus next matching message in depth first order"""
              self.focus_property(lambda x: x._message.matches(querystring),
                                  self._tree.next_position)
      Severity: Major
      Found in alot/buffers/thread.py and 1 other location - About 1 hr to fix
      alot/buffers/thread.py on lines 287..290

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

      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_matching(self, querystring):
              """focus previous matching message in depth first order"""
              self.focus_property(lambda x: x._message.matches(querystring),
                                  self._tree.prev_position)
      Severity: Major
      Found in alot/buffers/thread.py and 1 other location - About 1 hr to fix
      alot/buffers/thread.py on lines 282..285

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

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

      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

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

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

              if self.isinitialized:
                  focusposition = self.taglist.get_focus()[1]
              else:
                  focusposition = 0
                  self.isinitialized = True
      Severity: Minor
      Found in alot/buffers/taglist.py and 1 other location - About 50 mins to fix
      alot/buffers/bufferlist.py on lines 31..35

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

      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

              if self.isinitialized:
                  focusposition = self.bufferlist.get_focus()[1]
              else:
                  focusposition = 0
                  self.isinitialized = True
      Severity: Minor
      Found in alot/buffers/bufferlist.py and 1 other location - About 50 mins to fix
      alot/buffers/taglist.py on lines 25..29

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

      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

      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

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

            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

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

                  Severity
                  Category
                  Status
                  Source
                  Language