hackedteam/vector-edk

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

Summary

Maintainability
F
4 days
Test Coverage

Function mimify_part has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
Open

def mimify_part(ifile, ofile, is_mime):
    """Convert an 8bit part of a MIME mail message to quoted-printable."""
    has_cte = is_qp = is_base64 = 0
    multipart = None
    must_quote_body = must_quote_header = has_iso_chars = 0
Severity: Minor
Found in vector-uefi/fd/efi/StdLib/lib/python.27/mimify.py - About 2 days 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 unmimify_part has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

def unmimify_part(ifile, ofile, decode_base64 = 0):
    """Convert a quoted-printable part of a MIME mail message to 8bit."""
    multipart = None
    quoted_printable = 0
    is_base64 = 0
Severity: Minor
Found in vector-uefi/fd/efi/StdLib/lib/python.27/mimify.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 mimify.py has 413 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/bin/env python

"""Mimification and unmimification of mail messages.

Decode quoted-printable parts of a mail message or encode using
Severity: Minor
Found in vector-uefi/fd/efi/StdLib/lib/python.27/mimify.py - About 5 hrs to fix

    Function mime_encode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def mime_encode(line, header):
        """Code a single line as quoted-printable.
        If header is set, quote some extra characters."""
        if header:
            reg = mime_header_char
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/mimify.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 readline has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def readline(self):
            if self.peek is not None:
                line = self.peek
                self.peek = None
            else:
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/mimify.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 readline has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def readline(self):
            if self.peek is not None:
                return ''
            line = self.file.readline()
            if not line:
    Severity: Minor
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/mimify.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

    Avoid too many return statements within this function.
    Open

            return line
    Severity: Major
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/mimify.py - About 30 mins to fix

      Function mimify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def mimify(infile, outfile):
          """Convert 8bit parts of a MIME mail message to quoted-printable."""
          if type(infile) == type(''):
              ifile = open(infile)
              if type(outfile) == type('') and infile == outfile:
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/mimify.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 unmimify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def unmimify(infile, outfile, decode_base64 = 0):
          """Convert quoted-printable parts of a MIME mail message to 8bit."""
          if type(infile) == type(''):
              ifile = open(infile)
              if type(outfile) == type('') and infile == outfile:
      Severity: Minor
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/mimify.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

      There are no issues that match your filters.

      Category
      Status