hackedteam/vector-edk

View on GitHub

Showing 9,525 of 13,510 total issues

OrderedDict has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class OrderedDict(dict):
    'Dictionary that remembers insertion order'
    # An inherited dict maps keys to values.
    # The inherited dict provides __getitem__, __len__, __contains__, and get.
    # The remaining methods are order-aware.
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/collections.py - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

            if not hasattr(entry[0], '__call__') or \
               not hasattr(entry[1], '__call__') or \
               (entry[2] is not None and not hasattr(entry[2], '__call__')) or \
               (entry[3] is not None and not hasattr(entry[3], '__call__')) or \
               (len(entry) > 4 and entry[4] is not None and not hasattr(entry[4], '__call__')) or \
    Severity: Critical
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/encodings/__init__.py - About 2 hrs to fix

      SymbolVisitor has 24 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class SymbolVisitor:
          def __init__(self):
              self.scopes = {}
              self.klass = None
      
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/compiler/symbols.py - About 2 hrs to fix

        HelpFormatter has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class HelpFormatter(object):
            """Formatter for generating usage messages and argument help strings.
        
            Only the name of this class is considered a public API. All the methods
            provided by the class are considered an implementation detail.
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/argparse.py - About 2 hrs to fix

          GzipFile has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class GzipFile(io.BufferedIOBase):
              """The GzipFile class simulates most of the methods of a file object with
              the exception of the readinto() and truncate() methods.
          
              """
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/gzip.py - About 2 hrs to fix

            Maildir has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Maildir(Mailbox):
                """A qmail-style Maildir mailbox."""
            
                colon = ':'
            
            Severity: Minor
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/mailbox.py - About 2 hrs to fix

              HTMLParser has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class HTMLParser(markupbase.ParserBase):
                  """Find tags and other markup and call handler functions.
              
                  Usage:
                      p = HTMLParser()
              Severity: Minor
              Found in vector-uefi/fd/efi/StdLib/lib/python.27/HTMLParser.py - About 2 hrs to fix

                IOBase has 24 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class IOBase:
                    __metaclass__ = abc.ABCMeta
                
                    """The abstract base class for all I/O classes, acting on streams of
                    bytes. There is no public constructor.
                Severity: Minor
                Found in vector-uefi/fd/efi/StdLib/lib/python.27/_pyio.py - About 2 hrs to fix

                  OrderedDict has 24 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class OrderedDict(dict):
                      'Dictionary that remembers insertion order'
                      # An inherited dict maps keys to values.
                      # The inherited dict provides __getitem__, __len__, __contains__, and get.
                      # The remaining methods are order-aware.
                  Severity: Minor
                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/collections.py - About 2 hrs to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if not hasattr(entry[0], '__call__') or \
                               not hasattr(entry[1], '__call__') or \
                               (entry[2] is not None and not hasattr(entry[2], '__call__')) or \
                               (entry[3] is not None and not hasattr(entry[3], '__call__')) or \
                               (len(entry) > 4 and entry[4] is not None and not hasattr(entry[4], '__call__')) or \
                    Severity: Critical
                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/encodings/__init__.py - About 2 hrs to fix

                      SymbolVisitor has 24 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class SymbolVisitor:
                          def __init__(self):
                              self.scopes = {}
                              self.klass = None
                      
                      Severity: Minor
                      Found in vector-uefi/fd/efi/StdLib/lib/python.27/compiler/symbols.py - About 2 hrs to fix

                        HelpFormatter has 24 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class HelpFormatter(object):
                            """Formatter for generating usage messages and argument help strings.
                        
                            Only the name of this class is considered a public API. All the methods
                            provided by the class are considered an implementation detail.
                        Severity: Minor
                        Found in vector-uefi/fd/efi/StdLib/lib/python.27/argparse.py - About 2 hrs to fix

                          File timeit.py has 276 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          #! /usr/bin/env python
                          
                          """Tool for measuring execution time of small code snippets.
                          
                          This module avoids a number of common traps for measuring execution
                          Severity: Minor
                          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/timeit.py - About 2 hrs to fix

                            File xmlreader.py has 276 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            """An XML Reader is the SAX 2 name for an XML parser. XML Parsers
                            should be based on this code. """
                            
                            import handler
                            
                            Severity: Minor
                            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/xml/sax/xmlreader.py - About 2 hrs to fix

                              File timeit.py has 276 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              #! /usr/bin/env python
                              
                              """Tool for measuring execution time of small code snippets.
                              
                              This module avoids a number of common traps for measuring execution
                              Severity: Minor
                              Found in vector-uefi/fd/efi/StdLib/lib/python.27/timeit.py - About 2 hrs to fix

                                File xmlreader.py has 276 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                """An XML Reader is the SAX 2 name for an XML parser. XML Parsers
                                should be based on this code. """
                                
                                import handler
                                
                                Severity: Minor
                                Found in vector-uefi/fd/efi/StdLib/lib/python.27/xml/sax/xmlreader.py - About 2 hrs to fix

                                  File pyclbr.py has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  """Parse a Python module and describe its classes and methods.
                                  
                                  Parse enough of a Python file to recognize imports and class and
                                  method definitions, and to find out the superclasses of a class.
                                  
                                  Severity: Minor
                                  Found in AppPkg/Applications/Python/Python-2.7.2/Lib/pyclbr.py - About 2 hrs to fix

                                    File pyclbr.py has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    """Parse a Python module and describe its classes and methods.
                                    
                                    Parse enough of a Python file to recognize imports and class and
                                    method definitions, and to find out the superclasses of a class.
                                    
                                    Severity: Minor
                                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/pyclbr.py - About 2 hrs to fix

                                      Function _PackIntValue has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def _PackIntValue(self, IntValue, Size):
                                              if Size not in _FORMAT_CHAR.keys():
                                                  EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, 
                                                                  "Invalid size %d for PCD %s in integer datum size(File: %s Line: %s)." % (Size, self.PcdCName, self.FileName, self.Lineno))        
                                              
                                      Severity: Minor
                                      Found in BaseTools/Source/Python/BPDG/GenVpd.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 SaveFileOnChange has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      def SaveFileOnChange(File, Content, IsBinaryFile=True):
                                          if not IsBinaryFile:
                                              Content = Content.replace("\n", os.linesep)
                                      
                                          if os.path.exists(File):
                                      Severity: Minor
                                      Found in BaseTools/Source/Python/Common/Misc.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language