deps/v8/tools/generate_shim_headers/generate_shim_headers.py

Summary

Maintainability
D
1 day
Test Coverage

Function GeneratorMain has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
Open

def GeneratorMain(argv):
  parser = optparse.OptionParser()
  parser.add_option('--headers-root', action='append')
  parser.add_option('--define', action='append')
  parser.add_option('--output-directory')
Severity: Minor
Found in deps/v8/tools/generate_shim_headers/generate_shim_headers.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

Avoid deeply nested control flow statements.
Open

          if options.define:
            for define in options.define:
              key, value = define.split('=', 1)
              # This non-standard push_macro extension is supported
              # by compilers we support (GCC, clang).
Severity: Major
Found in deps/v8/tools/generate_shim_headers/generate_shim_headers.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

              if include_before:
                for header in include_before.split(':'):
                  f.write('#include %s\n' % header)
    
    
    Severity: Major
    Found in deps/v8/tools/generate_shim_headers/generate_shim_headers.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                if include_after:
                  for header in include_after.split(':'):
                    f.write('#include %s\n' % header)
      
      
      Severity: Major
      Found in deps/v8/tools/generate_shim_headers/generate_shim_headers.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  if options.define:
                    for define in options.define:
                      key, value = define.split('=', 1)
                      # This non-standard pop_macro extension is supported
                      # by compilers we support (GCC, clang).
        Severity: Major
        Found in deps/v8/tools/generate_shim_headers/generate_shim_headers.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    if options.use_include_next:
                      f.write('#include_next <%s>\n' % include_target)
                    else:
                      f.write('#include <%s>\n' % include_target)
          
          
          Severity: Major
          Found in deps/v8/tools/generate_shim_headers/generate_shim_headers.py - About 45 mins to fix

            There are no issues that match your filters.

            Category
            Status