hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/treesync.py

Summary

Maintainability
C
1 day
Test Coverage

Function process has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

def process(slave, master):
    cvsdir = os.path.join(master, "CVS")
    if not os.path.isdir(cvsdir):
        print "skipping master subdirectory", master
        print "-- not under CVS"
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/treesync.py - About 3 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 main has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def main():
    global always_no, always_yes
    global create_directories, write_master, write_slave
    opts, args = getopt.getopt(sys.argv[1:], "nym:s:d:f:a:")
    for o, a in opts:
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/treesync.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 compare has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def compare(slave, master):
    try:
        sf = open(slave, 'r')
    except IOError:
        sf = None
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/treesync.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 copy has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def copy(src, dst, rmode="rb", wmode="wb", answer='ask'):
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/treesync.py - About 35 mins to fix

    Avoid too many return statements within this function.
    Open

            return
    Severity: Major
    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/treesync.py - About 30 mins to fix

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

      def okay(prompt, answer='ask'):
          answer = answer.strip().lower()
          if not answer or answer[0] not in 'ny':
              answer = raw_input(prompt)
              answer = answer.strip().lower()
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/treesync.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 funnychars has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def funnychars(f):
          while 1:
              buf = f.read(BUFSIZE)
              if not buf: break
              if '\r' in buf or '\0' in buf: return 1
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/treesync.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