tools/gyp/pylib/gyp/mac_tool.py

Summary

Maintainability
C
1 day
Test Coverage

File mac_tool.py has 392 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/mac_tool.py - About 5 hrs to fix

    MacTool has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MacTool(object):
      """This class performs all the Mac tooling steps. The methods can either be
      executed directly, or dispatched from an argument list."""
    
      def Dispatch(self, args):
    Severity: Minor
    Found in tools/gyp/pylib/gyp/mac_tool.py - About 2 hrs to fix

      Function _FindProvisioningProfile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def _FindProvisioningProfile(self, profile, bundle_identifier):
          """Finds the .mobileprovision file to use for signing the bundle.
      
          Checks all the installed provisioning profiles (or if the user specified
          the PROVISIONING_PROFILE variable, only consult it) and select the most
      Severity: Minor
      Found in tools/gyp/pylib/gyp/mac_tool.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 _CopyXIBFile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def _CopyXIBFile(self, source, dest):
          """Compiles a XIB file with ibtool into a binary plist in the bundle."""
      
          # ibtool sometimes crashes with relative paths. See crbug.com/314728.
          base = os.path.dirname(os.path.realpath(__file__))
      Severity: Minor
      Found in tools/gyp/pylib/gyp/mac_tool.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 _InstallEntitlements has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def _InstallEntitlements(self, entitlements, substitutions, overrides):
          """Generates and install the ${BundleName}.xcent entitlements file.
      
          Expands variables "$(variable)" pattern in the source entitlements file,
          add extra entitlements defined in the .mobileprovision file and the copy
      Severity: Minor
      Found in tools/gyp/pylib/gyp/mac_tool.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

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

        def ExecCopyInfoPlist(self, source, dest, *keys):
          """Copies the |source| Info.plist to the destination directory |dest|."""
          # Read the source Info.plist into memory.
          fd = open(source, 'r')
          lines = fd.read()
      Severity: Minor
      Found in tools/gyp/pylib/gyp/mac_tool.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

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

        def ExecCopyBundleResource(self, source, dest):
          """Copies a resource file to the bundle/Resources directory, performing any
          necessary compilation on each resource."""
          extension = os.path.splitext(source)[1].lower()
          if os.path.isdir(source):
      Severity: Minor
      Found in tools/gyp/pylib/gyp/mac_tool.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

      Avoid too many return statements within this function.
      Open

            return None
      Severity: Major
      Found in tools/gyp/pylib/gyp/mac_tool.py - About 30 mins to fix

        There are no issues that match your filters.

        Category
        Status