tools/gyp/pylib/gyp/__init__.py

Summary

Maintainability
F
3 days
Test Coverage

Function gyp_main has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
Open

def gyp_main(args):
  my_name = os.path.basename(sys.argv[0])

  parser = RegeneratableOptionParser()
  usage = 'usage: %s [options ...] [build_file ...]'
Severity: Minor
Found in tools/gyp/pylib/gyp/__init__.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

File __init__.py has 396 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python

# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
Severity: Minor
Found in tools/gyp/pylib/gyp/__init__.py - About 5 hrs to fix

    Function RegenerateFlags has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def RegenerateFlags(options):
      """Given a parsed options object, and taking the environment variables into
      account, returns a list of flags that should regenerate an equivalent options
      object (even in the absence of the environment variables.)
    
    
    Severity: Minor
    Found in tools/gyp/pylib/gyp/__init__.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 gyp_main has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def gyp_main(args):
      my_name = os.path.basename(sys.argv[0])
    
      parser = RegeneratableOptionParser()
      usage = 'usage: %s [options ...] [build_file ...]'
    Severity: Minor
    Found in tools/gyp/pylib/gyp/__init__.py - About 1 hr to fix

      Function RegenerateAppendFlag has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def RegenerateAppendFlag(flag, values, predicate, env_name, options):
        """Regenerate a list of command line flags, for an option of action='append'.
      
        The |env_name|, if given, is checked in the environment and used to generate
        an initial list of options, then the options that were specified on the
      Severity: Minor
      Found in tools/gyp/pylib/gyp/__init__.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 Load has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def Load(build_files, format, default_variables={},
      Severity: Major
      Found in tools/gyp/pylib/gyp/__init__.py - About 1 hr to fix

        Function Load has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def Load(build_files, format, default_variables={},
                 includes=[], depth='.', params=None, check=False,
                 circular_check=True):
          """
          Loads one or more specified build files.
        Severity: Minor
        Found in tools/gyp/pylib/gyp/__init__.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 DebugOutput has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def DebugOutput(mode, message, *args):
          if 'all' in gyp.debug or mode in gyp.debug:
            ctx = ('unknown', 0, 'unknown')
            try:
              f = traceback.extract_stack(limit=2)
        Severity: Minor
        Found in tools/gyp/pylib/gyp/__init__.py - About 45 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

        Avoid deeply nested control flow statements.
        Open

                  if not os.path.exists(home_dot_gyp):
                    home_dot_gyp = None
                  else:
                    break
          else:
        Severity: Major
        Found in tools/gyp/pylib/gyp/__init__.py - About 45 mins to fix

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

          def RegenerateAppendFlag(flag, values, predicate, env_name, options):
          Severity: Minor
          Found in tools/gyp/pylib/gyp/__init__.py - About 35 mins to fix

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

            def NameValueListToDict(name_value_list):
              """
              Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary
              of the pairs.  If a string is simply NAME, then the value in the dictionary
              is set to True.  If VALUE can be converted to an integer, it is.
            Severity: Minor
            Found in tools/gyp/pylib/gyp/__init__.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

            There are no issues that match your filters.

            Category
            Status