hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.py

Summary

Maintainability
F
1 mo
Test Coverage

File smtplib.py has 646 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/bin/env python

'''SMTP/ESMTP client class.

This should follow RFC 821 (SMTP), RFC 1869 (ESMTP), RFC 2554 (SMTP
Severity: Major
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.py - About 1 day to fix

    SMTP has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SMTP:
        """This class manages a connection to an SMTP or ESMTP server.
        SMTP Objects:
            SMTP objects have the following attributes:
                helo_resp
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.py - About 2 hrs to fix

      Function sendmail has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def sendmail(self, from_addr, to_addrs, msg, mail_options=[],
                       rcpt_options=[]):
              """This command performs an entire mail transaction.
      
              The arguments are:
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.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 getreply has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def getreply(self):
              """Get a reply from the server.
      
              Returns a tuple consisting of:
      
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.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 login has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def login(self, user, password):
              """Log in on an SMTP server that requires authentication.
      
              The arguments are:
                  - user:     The user name to authenticate with.
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.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 ehlo has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def ehlo(self, name=''):
              """ SMTP 'ehlo' command.
              Hostname to send for this command defaults to the FQDN of the local
              host.
              """
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.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 __init__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, host='', port=0, local_hostname=None,
                       timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
              """Initialize a new instance.
      
              If specified, `host' is the name of the remote host to which to
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.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 connect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def connect(self, host='localhost', port=0):
              """Connect to a host on a given port.
      
              If the hostname ends with a colon (`:') followed by a number, and
              there is no port specified, that suffix will be stripped off and the
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def __init__(self, host='', port=0, local_hostname=None,
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.py - About 45 mins to fix

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

            def sendmail(self, from_addr, to_addrs, msg, mail_options=[],
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.py - About 35 mins to fix

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

              def connect(self, host='localhost', port=0):
                  """Connect to the LMTP daemon, on either a Unix or a TCP socket."""
                  if host[0] != '/':
                      return SMTP.connect(self, host, port)
          
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.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 data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def data(self, msg):
                  """SMTP 'DATA' command -- sends message data to server.
          
                  Automatically quotes lines beginning with a period per rfc821.
                  Raises SMTPDataError if there is an unexpected reply to the
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.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 send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def send(self, str):
                  """Send `str' to the server."""
                  if self.debuglevel > 0:
                      print>>stderr, 'send:', repr(str)
                  if hasattr(self, 'sock') and self.sock:
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.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 ehlo_or_helo_if_needed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def ehlo_or_helo_if_needed(self):
                  """Call self.ehlo() and/or self.helo() if needed.
          
                  If there has been no previous EHLO or HELO command this session, this
                  method tries ESMTP EHLO first.
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.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 AppPkg/Applications/Python/Python-2.7.2/Lib/smtplib.py and 1 other location - About 1 mo to fix
          vector-uefi/fd/efi/StdLib/lib/python.27/smtplib.py on lines 0..848

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

          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