alot/commands/envelope.py

Summary

Maintainability
D
2 days
Test Coverage

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

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

        def apply(self, ui):
            sign = None
            envelope = ui.current_buffer.envelope
            # sign status
            if self.action == 'sign':
    Severity: Minor
    Found in alot/commands/envelope.py - About 2 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 __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 apply has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def apply(self, ui):
              ebuffer = ui.current_buffer
              envelope = ebuffer.envelope
      
              if self.action == "txt2html":
      Severity: Minor
      Found in alot/commands/envelope.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

      FIXME found
      Open

              # FIXME: handle BCC as well
      Severity: Minor
      Found in alot/commands/envelope.py by fixme

      FIXME found
      Open

              # FIXME: handle BCC as well
      Severity: Minor
      Found in alot/commands/envelope.py by fixme

      Line break before binary operator
      Open

                          and not self._is_encrypted_to_all_recipients()):
      Severity: Minor
      Found in alot/commands/envelope.py by pep8

      Avoid breaks before binary operators.

      The preferred place to break around a binary operator is after the
      operator, not before it.
      
      W503: (width == 0\n + height == 0)
      W503: (width == 0\n and height == 0)
      W503: var = (1\n       & ~2)
      W503: var = (1\n       / -2)
      W503: var = (1\n       + -1\n       + -2)
      
      Okay: foo(\n    -x)
      Okay: foo(x\n    [])
      Okay: x = '''\n''' + ''
      Okay: foo(x,\n    -y)
      Okay: foo(x,  # comment\n    -y)

      There are no issues that match your filters.

      Category
      Status