Showing 1,896 of 2,859 total issues

Function _FindDirectXInstallation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def _FindDirectXInstallation():
  """Try to find an installation location for the DirectX SDK. Check for the
  standard environment variable, and if that doesn't exist, try to find
  via the registry. May return None if not found in either location."""
  # Return previously calculated value, if there is one
Severity: Minor
Found in tools/gyp/pylib/gyp/msvs_emulation.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

Function MergeLists has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def MergeLists(to, fro, to_file, fro_file, is_paths=False, append=True):
Severity: Minor
Found in tools/gyp/pylib/gyp/input.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

              if build_file_dir:  # build_file_dir may be None (see above).
                os.chdir(build_file_dir)
              try:
    Severity: Major
    Found in tools/gyp/pylib/gyp/input.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                if t == target_name:
                  if targets[t].get('variables', {}).get('prune_self_dependency', 0):
                    target_dict[dependency_key] = Filter(dependencies, target_name)
      
      
      Severity: Major
      Found in tools/gyp/pylib/gyp/input.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    for item in value:
                      self._properties[property].append(item.Copy())
                  else:
        Severity: Major
        Found in tools/gyp/pylib/gyp/xcodeproj_file.py - About 45 mins to fix

          Function LoadBuildFileIncludesIntoList has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def LoadBuildFileIncludesIntoList(sublist, sublist_path, data, aux_data,
          Severity: Minor
          Found in tools/gyp/pylib/gyp/input.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if (dependency_target != '*' and
                          dependency_target != dependency_target_name):
                        continue
                      dependency_target_toolset = dependency_target_dict['toolset']
            Severity: Major
            Found in tools/gyp/pylib/gyp/input.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        if list_actions[index] == action_value:
                          # Even if the regex matches, nothing will change so continue (regex
                          # searches are expensive).
                          continue
                        if pattern_re.search(list_item):
              Severity: Major
              Found in tools/gyp/pylib/gyp/input.py - About 45 mins to fix

                Function ValidateSourcesInTarget has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def ValidateSourcesInTarget(target, target_dict, build_file):
                  # TODO: Check if MSVC allows this for loadable_module targets.
                  if target_dict.get('type', None) not in ('static_library', 'shared_library'):
                    return
                  sources = target_dict.get('sources', [])
                Severity: Minor
                Found in tools/gyp/pylib/gyp/input.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 pattern_re.search(list_item):
                            # Regular expression match.
                            list_actions[index] = action_value
                
                      # The "whatever/" list is no longer needed, dump it.
                Severity: Major
                Found in tools/gyp/pylib/gyp/input.py - About 45 mins to fix

                  Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def __init__(self, properties=None, id=None, parent=None,
                  Severity: Minor
                  Found in tools/gyp/pylib/gyp/xcodeproj_file.py - About 45 mins to fix

                    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def __init__(self, properties=None, id=None, parent=None,
                    Severity: Minor
                    Found in tools/gyp/pylib/gyp/xcodeproj_file.py - About 45 mins to fix

                      Function TurnIntIntoStrInDict has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def TurnIntIntoStrInDict(the_dict):
                        """Given dict the_dict, recursively converts all integers into strings.
                        """
                        # Use items instead of iteritems because there's no need to try to look at
                        # reinserted keys and their associated values.
                      Severity: Minor
                      Found in tools/gyp/pylib/gyp/input.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

                      Function AddDependency has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def AddDependency(self, other):
                          # super
                          XCTarget.AddDependency(self, other)
                      
                          static_library_type = 'com.apple.product-type.library.static'
                      Severity: Minor
                      Found in tools/gyp/pylib/gyp/xcodeproj_file.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 p.wait() != 0 or p_stderr:
                                  sys.stderr.write(p_stderr)
                                  # Simulate check_call behavior, since check_call only exists
                                  # in python 2.5 and later.
                                  raise GypError("Call to '%s' returned exit status %d." %
                      Severity: Major
                      Found in tools/gyp/pylib/gyp/input.py - About 45 mins to fix

                        Function rule has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def rule(self, name, command, description=None, depfile=None,
                                     generator=False, pool=None, restat=False, rspfile=None,
                                     rspfile_content=None, deps=None):
                                self._line('rule %s' % name)
                                self.variable('command', command, indent=1)
                        Severity: Minor
                        Found in tools/gyp/pylib/gyp/ninja_syntax.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

                        Function HasRun has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def HasRun(self, output):
                            total = self.succeeded + len(self.failed)
                            if (total > 1) and (total % 50 == 1):
                              sys.stdout.write('\n')
                            if output.UnexpectedOutput():
                        Severity: Minor
                        Found in tools/test.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

                        Function CheckComment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def CheckComment(comment, filename, linenum, error):
                          """Checks for common mistakes in TODO comments.
                        
                          Args:
                            comment: The text of the comment from the line in question.
                        Severity: Minor
                        Found in tools/cpplint.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 CheckLanguage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def CheckLanguage(filename, clean_lines, linenum, file_extension, include_state,
                          Severity: Minor
                          Found in tools/cpplint.py - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language