hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/Python-2.7.2/Tools/pybench/CommandLine.py

Summary

Maintainability
D
2 days
Test Coverage

File CommandLine.py has 421 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" CommandLine - Get and parse command line options

    NOTE: This still is very much work in progress !!!

    Different version are likely to be incompatible.
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Tools/pybench/CommandLine.py - About 6 hrs to fix

    Function parse has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse(self):
    
            """ Parse the command line and fill in self.values and self.files.
    
                After having parsed the options, the remaining command line
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/pybench/CommandLine.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 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self,argv=None):
    
            # Setup application specs
            if argv is None:
                argv = sys.argv
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/pybench/CommandLine.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 _getopt_flags has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def _getopt_flags(options):
    
        """ Convert the option list to a getopt flag string and long opt
            list
    

    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 fileopen has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def fileopen(name, mode='wb', encoding=None):
    
        """ Open a file using mode.
    
            Default mode is 'wb' meaning to open the file for writing in
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/pybench/CommandLine.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 abspath has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def abspath(path,
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/pybench/CommandLine.py - About 35 mins to fix

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

          def help(self,note=''):
      
              self.print_header()
              if self.synopsis:
                  print 'Synopsis:'
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Tools/pybench/CommandLine.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