hackedteam/vector-edk

View on GitHub
vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.py

Summary

Maintainability
F
3 mos
Test Coverage

File imaplib.py has 1037 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""IMAP4 client.

Based on RFC 2060.

Public class:           IMAP4
Severity: Major
Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.py - About 2 days to fix

    IMAP4 has 67 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class IMAP4:
    
        """IMAP4 client class.
    
        Instantiate with: IMAP4([host[, port]])
    Severity: Major
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.py - About 1 day to fix

      Function _command has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          def _command(self, name, *args):
      
              if self.state not in Commands[name]:
                  self.literal = None
                  raise self.error("command %s illegal in state %s, "
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.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 _get_response has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_response(self):
      
              # Read response and store.
              #
              # Returns None for continuation responses,
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.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 __init__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, host = '', port = IMAP4_PORT):
              self.debug = Debug
              self.state = 'LOGOUT'
              self.literal = None             # A literal argument to a command
              self.tagged_commands = {}       # Tagged commands awaiting response
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.py - About 1 hr 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_tagged_response has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_tagged_response(self, tag):
      
              while 1:
                  result = self.tagged_commands[tag]
                  if result is not None:
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.py - About 1 hr 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 select has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def select(self, mailbox='INBOX', readonly=False):
              """Select a mailbox.
      
              Flush all untagged responses.
      
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.py - About 1 hr 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 print_log has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def print_log(self):
                  self._mesg('last %d IMAP4 interactions:' % len(self._cmd_log))
                  i, n = self._cmd_log_idx, self._cmd_log_len
                  while n:
                      try:
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.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 append has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def append(self, mailbox, flags, date_time, message):
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.py - About 35 mins to fix

        Function partial has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def partial(self, message_num, message_part, start, length):
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.py - About 35 mins to fix

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

          def Time2Internaldate(date_time):
          
              """Convert date_time to IMAP4 INTERNALDATE representation.
          
              Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'.  The
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.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 append has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def append(self, mailbox, flags, date_time, message):
                  """Append message to named mailbox.
          
                  (typ, [data]) = <instance>.append(mailbox, flags, date_time, message)
          
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.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 _get_line has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def _get_line(self):
          
                  line = self.readline()
                  if not line:
                      raise self.abort('socket error: EOF')
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.py - About 25 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 encode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def encode(self, inp):
                  #
                  #  Invoke binascii.b2a_base64 iteratively with
                  #  short even length buffers, strip the trailing
                  #  line feed from the result and append.  "Even"
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.py - About 25 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 _append_untagged has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def _append_untagged(self, typ, dat):
          
                  if dat is None: dat = ''
                  ur = self.untagged_responses
                  if __debug__:
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.py - About 25 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

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

          Severity: Major
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/imaplib.py and 1 other location - About 2 mos to fix
          AppPkg/Applications/Python/Python-2.7.2/Lib/imaplib.py on lines 0..1518

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

          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

          There are no issues that match your filters.

          Category
          Status