tools/gyp/pylib/gyp/generator/msvs.py

Summary

Maintainability
F
2 wks
Test Coverage

File msvs.py has 2599 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# 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.

import collections
Severity: Major
Found in tools/gyp/pylib/gyp/generator/msvs.py - About 1 wk to fix

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

    def _AddSources2(spec, sources, exclusions, grouped_sources,
                     extension_to_rule_name, sources_handled_by_action,
                     list_excluded):
      extensions_excluded_from_precompile = []
      for source in sources:
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/msvs.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

    Function _BuildCommandLineForRuleRaw has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path,
                                    quote_cmd, do_setup_env):
    
      if [x for x in cmd if '$(InputDir)' in x]:
        input_dir_preamble = (
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/msvs.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 _HandlePreCompiledHeaders has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def _HandlePreCompiledHeaders(p, sources, spec):
      # Pre-compiled header source stubs need a different compiler flag
      # (generate precompiled header) and any source file not of the same
      # kind (i.e. C vs. C++) as the precompiled header source stub needs
      # to have use of precompiled headers disabled.
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/msvs.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 _ConvertSourcesToFilterHierarchy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def _ConvertSourcesToFilterHierarchy(sources, prefix=None, excluded=None,
                                         list_excluded=True, msvs_version=None):
      """Converts a list split source file paths into a vcproj folder hierarchy.
    
      Arguments:
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/msvs.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 _GetMSBuildPropertyGroup has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def _GetMSBuildPropertyGroup(spec, label, properties):
      """Returns a PropertyGroup definition for the specified properties.
    
      Arguments:
        spec: The target project dict.
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/msvs.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 _GetMSBuildToolSettingsSections has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def _GetMSBuildToolSettingsSections(spec, configurations):
      groups = []
      for (name, configuration) in sorted(configurations.iteritems()):
        msbuild_settings = configuration['finalized_msbuild_settings']
        group = ['ItemDefinitionGroup',
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/msvs.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 _ConvertToolsToExpectedForm has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def _ConvertToolsToExpectedForm(tools):
      """Convert tools to a form expected by Visual Studio.
    
      Arguments:
        tools: A dictionary of settings; the tool name is the key.
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/msvs.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 _ToolSetOrAppend has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False):
      # TODO(bradnelson): ugly hack, fix this more generally!!!
      if 'Directories' in setting or 'Dependencies' in setting:
        if type(value) == str:
          value = value.replace('/', '\\')
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/msvs.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 GenerateOutput has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def GenerateOutput(target_list, target_dicts, data, params):
      """Generate .sln and .vcproj files.
    
      This is the entry point for this generator.
      Arguments:
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/msvs.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 _GenerateMSBuildProject has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def _GenerateMSBuildProject(project, options, version, generator_flags):
      spec = project.spec
      configurations = spec['configurations']
      project_dir, project_file_name = os.path.split(project.path)
      gyp.common.EnsureDirExists(project.path)
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/msvs.py - About 1 hr to fix

      Function _GetMSBuildAttributes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def _GetMSBuildAttributes(spec, config, build_file):
        if 'msbuild_configuration_attributes' not in config:
          msbuild_attributes = _ConvertMSVSBuildAttributes(spec, config, build_file)
      
        else:
      Severity: Minor
      Found in tools/gyp/pylib/gyp/generator/msvs.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 _FinalizeMSBuildSettings has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def _FinalizeMSBuildSettings(spec, configuration):
        if 'msbuild_settings' in configuration:
          converted = False
          msbuild_settings = configuration['msbuild_settings']
          MSVSSettings.ValidateMSBuildSettings(msbuild_settings)
      Severity: Minor
      Found in tools/gyp/pylib/gyp/generator/msvs.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 _AppendFiltersForMSBuild has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def _AppendFiltersForMSBuild(parent_filter_name, sources,
                                   extension_to_rule_name,
                                   filter_group, source_group):
        """Creates the list of filters and sources to be added in the filter file.
      
      
      Severity: Minor
      Found in tools/gyp/pylib/gyp/generator/msvs.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 _GenerateExternalRules has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def _GenerateExternalRules(rules, output_dir, spec,
                                 sources, options, actions_to_add):
        """Generate an external makefile to do a set of rules.
      
        Arguments:
      Severity: Minor
      Found in tools/gyp/pylib/gyp/generator/msvs.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 _GetMSBuildConfigurationGlobalProperties has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
        # TODO(jeanluc) We could optimize out the following and do it only if
        # there are actions.
        # TODO(jeanluc) Handle the equivalent of setting 'CYGWIN=nontsec'.
        new_paths = []
      Severity: Minor
      Found in tools/gyp/pylib/gyp/generator/msvs.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 _VerifySourcesExist has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def _VerifySourcesExist(sources, root_dir):
        """Verifies that all source files exist on disk.
      
        Checks that all regular source files, i.e. not created at run time,
        exist on disk.  Missing files cause needless recompilation but no otherwise
      Severity: Minor
      Found in tools/gyp/pylib/gyp/generator/msvs.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 _GetMSBuildPropertySheets has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _GetMSBuildPropertySheets(configurations):
        user_props = r'$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props'
        additional_props = {}
        props_specified = False
        for name, settings in sorted(configurations.iteritems()):
      Severity: Minor
      Found in tools/gyp/pylib/gyp/generator/msvs.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 _GetDomainAndUserName has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _GetDomainAndUserName():
        if sys.platform not in ('win32', 'cygwin'):
          return ('DOMAIN', 'USERNAME')
        global cached_username
        global cached_domain
      Severity: Minor
      Found in tools/gyp/pylib/gyp/generator/msvs.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 _GenerateRulesForMSBuild has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _GenerateRulesForMSBuild(output_dir, options, spec,
      Severity: Major
      Found in tools/gyp/pylib/gyp/generator/msvs.py - About 1 hr to fix

        Function _AddConfigurationToMSVSProject has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config):
          """Adds a configuration to the MSVS project.
        
          Many settings in a vcproj file are specific to a configuration.  This
          function the main part of the vcproj file that's configuration specific.
        Severity: Minor
        Found in tools/gyp/pylib/gyp/generator/msvs.py - About 1 hr to fix

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

          def _GetMSBuildProjectReferences(project):
            references = []
            if project.dependencies:
              group = ['ItemGroup']
              for dependency in project.dependencies:
          Severity: Minor
          Found in tools/gyp/pylib/gyp/generator/msvs.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 _AdjustSourcesForRules has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def _AdjustSourcesForRules(spec, rules, sources, excluded_sources):
            # Add outputs generated by each rule (if applicable).
            for rule in rules:
              # Done if not processing outputs as sources.
              if int(rule.get('process_outputs_as_sources', False)):
          Severity: Minor
          Found in tools/gyp/pylib/gyp/generator/msvs.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 _GenerateMSVSProject has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def _GenerateMSVSProject(project, options, version, generator_flags):
            """Generates a .vcproj file.  It may create .rules and .user files too.
          
            Arguments:
              project: The project object we will generate the file for.
          Severity: Minor
          Found in tools/gyp/pylib/gyp/generator/msvs.py - About 1 hr to fix

            Function _AddMSBuildAction has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def _AddMSBuildAction(spec, primary_input, inputs, outputs, cmd, description,
            Severity: Major
            Found in tools/gyp/pylib/gyp/generator/msvs.py - About 1 hr to fix

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

              def _DictsToFolders(base_path, bucket, flat):
                # Convert to folders recursively.
                children = []
                for folder, contents in bucket.iteritems():
                  if type(contents) == dict:
              Severity: Minor
              Found in tools/gyp/pylib/gyp/generator/msvs.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 _InitNinjaFlavor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def _InitNinjaFlavor(options, target_list, target_dicts):
                """Initialize targets for the ninja flavor.
              
                This sets up the necessary variables in the targets to generate msvs projects
                that use ninja as an external builder. The variables in the spec are only set
              Severity: Minor
              Found in tools/gyp/pylib/gyp/generator/msvs.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 _GetExcludedFilesFromBuild has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl):
                exclusions = {}
                # Exclude excluded sources from being built.
                for f in excluded_sources:
                  excluded_configs = []
              Severity: Minor
              Found in tools/gyp/pylib/gyp/generator/msvs.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 _ConvertMSVSBuildAttributes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def _ConvertMSVSBuildAttributes(spec, config, build_file):
                config_type = _GetMSVSConfigurationType(spec, build_file)
                msvs_attributes = _GetMSVSAttributes(spec, config, config_type)
                msbuild_attributes = {}
                for a in msvs_attributes:
              Severity: Minor
              Found in tools/gyp/pylib/gyp/generator/msvs.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 _AddCustomBuildToolForMSVS has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def _AddCustomBuildToolForMSVS(p, spec, primary_input,
              Severity: Major
              Found in tools/gyp/pylib/gyp/generator/msvs.py - About 50 mins to fix

                Function _GetMSBuildSources has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def _GetMSBuildSources(spec, sources, exclusions, extension_to_rule_name,
                Severity: Major
                Found in tools/gyp/pylib/gyp/generator/msvs.py - About 50 mins to fix

                  Function _AddSources2 has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def _AddSources2(spec, sources, exclusions, grouped_sources,
                  Severity: Major
                  Found in tools/gyp/pylib/gyp/generator/msvs.py - About 50 mins to fix

                    Function _GenerateRulesForMSVS has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def _GenerateRulesForMSVS(p, output_dir, options, spec,
                    Severity: Major
                    Found in tools/gyp/pylib/gyp/generator/msvs.py - About 50 mins to fix

                      Function _AdjustSourcesAndConvertToFilterHierarchy has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def _AdjustSourcesAndConvertToFilterHierarchy(
                      Severity: Major
                      Found in tools/gyp/pylib/gyp/generator/msvs.py - About 50 mins to fix

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

                        def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path,
                        Severity: Minor
                        Found in tools/gyp/pylib/gyp/generator/msvs.py - About 45 mins to fix

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

                          def _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name):
                          Severity: Minor
                          Found in tools/gyp/pylib/gyp/generator/msvs.py - About 45 mins to fix

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

                            def _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl,
                                                            list_excluded):
                              exclusions = _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl)
                              for file_name, excluded_configs in exclusions.iteritems():
                                if (not list_excluded and
                            Severity: Minor
                            Found in tools/gyp/pylib/gyp/generator/msvs.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 precompiled_source == source:
                                        condition = _GetConfigurationCondition(config_name, configuration)
                                        detail.append(['PrecompiledHeader',
                                                       {'Condition': condition},
                                                       'Create'
                            Severity: Major
                            Found in tools/gyp/pylib/gyp/generator/msvs.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                        for name, value in sorted(tool_settings.iteritems()):
                                          formatted_value = _GetValueFormattedForMSBuild(tool_name, name,
                                                                                         value)
                                          tool.append([name, formatted_value])
                                        group.append(tool)
                              Severity: Major
                              Found in tools/gyp/pylib/gyp/generator/msvs.py - About 45 mins to fix

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

                                def _GenerateExternalRules(rules, output_dir, spec,
                                Severity: Minor
                                Found in tools/gyp/pylib/gyp/generator/msvs.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                            for config_name, configuration in sorted(excluded_configurations):
                                              condition = _GetConfigurationCondition(config_name, configuration)
                                              detail.append(['ExcludedFromBuild',
                                                             {'Condition': condition},
                                                             'true'])
                                  Severity: Major
                                  Found in tools/gyp/pylib/gyp/generator/msvs.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                              if precompiled_source != '':
                                                precompiled_source = _FixPath(precompiled_source)
                                                if not extensions_excluded_from_precompile:
                                                  # If the precompiled header is generated by a C source, we must
                                                  # not try to use it for C++ sources, and vice versa.
                                    Severity: Major
                                    Found in tools/gyp/pylib/gyp/generator/msvs.py - About 45 mins to fix

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

                                      def _CreateProjectObjects(target_list, target_dicts, options, msvs_version):
                                        """Create a MSVSProject object for the targets found in target list.
                                      
                                        Arguments:
                                          target_list: the list of targets to generate project objects for.
                                      Severity: Minor
                                      Found in tools/gyp/pylib/gyp/generator/msvs.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 _ToolAppend has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      def _ToolAppend(tools, tool_name, setting, value, only_if_unset=False):
                                      Severity: Minor
                                      Found in tools/gyp/pylib/gyp/generator/msvs.py - About 35 mins to fix

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

                                        def _AppendFiltersForMSBuild(parent_filter_name, sources,
                                        Severity: Minor
                                        Found in tools/gyp/pylib/gyp/generator/msvs.py - About 35 mins to fix

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

                                          def _ConvertSourcesToFilterHierarchy(sources, prefix=None, excluded=None,
                                          Severity: Minor
                                          Found in tools/gyp/pylib/gyp/generator/msvs.py - About 35 mins to fix

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

                                            def _AddActionStep(actions_dict, inputs, outputs, description, command):
                                            Severity: Minor
                                            Found in tools/gyp/pylib/gyp/generator/msvs.py - About 35 mins to fix

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

                                              def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config):
                                              Severity: Minor
                                              Found in tools/gyp/pylib/gyp/generator/msvs.py - About 35 mins to fix

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

                                                def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False):
                                                Severity: Minor
                                                Found in tools/gyp/pylib/gyp/generator/msvs.py - About 35 mins to fix

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

                                                  def _GenerateNativeRulesForMSVS(p, rules, output_dir, spec, options):
                                                  Severity: Minor
                                                  Found in tools/gyp/pylib/gyp/generator/msvs.py - About 35 mins to fix

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

                                                    def _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl,
                                                    Severity: Minor
                                                    Found in tools/gyp/pylib/gyp/generator/msvs.py - About 35 mins to fix

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

                                                      def _GetValueFormattedForMSBuild(tool_name, name, value):
                                                        if type(value) == list:
                                                          # For some settings, VS2010 does not automatically extends the settings
                                                          # TODO(jeanluc) Is this what we want?
                                                          if name in ['AdditionalIncludeDirectories',
                                                      Severity: Minor
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.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 _PrepareListOfSources has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      def _PrepareListOfSources(spec, generator_flags, gyp_file):
                                                        """Prepare list of sources and excluded sources.
                                                      
                                                        Besides the sources specified directly in the spec, adds the gyp file so
                                                        that a change to it will cause a re-compile. Also adds appropriate sources
                                                      Severity: Minor
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.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 _GetOutputFilePathAndTool has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      def _GetOutputFilePathAndTool(spec, msbuild):
                                                        """Returns the path and tool to use for this target.
                                                      
                                                        Figures out the path of the file this spec will create and the name of
                                                        the VC tool that will create it.
                                                      Severity: Minor
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.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 _AddConfigurationToMSVSProject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config):
                                                        """Adds a configuration to the MSVS project.
                                                      
                                                        Many settings in a vcproj file are specific to a configuration.  This
                                                        function the main part of the vcproj file that's configuration specific.
                                                      Severity: Minor
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.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 _GetCopies has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      def _GetCopies(spec):
                                                        copies = []
                                                        # Add copies.
                                                        for cpy in spec.get('copies', []):
                                                          for src in cpy.get('files', []):
                                                      Severity: Minor
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.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 _GenerateActionsForMSBuild has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      def _GenerateActionsForMSBuild(spec, actions_to_add):
                                                        """Add actions accumulated into an actions_to_add, merging as needed.
                                                      
                                                        Arguments:
                                                          spec: the target project dict
                                                      Severity: Minor
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.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 PerformBuild has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      def PerformBuild(data, configurations, params):
                                                        options = params['options']
                                                        msvs_version = params['msvs_version']
                                                        devenv = os.path.join(msvs_version.path, 'Common7', 'IDE', 'devenv.com')
                                                      
                                                      
                                                      Severity: Minor
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.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 _GenerateRulesForMSBuild has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      def _GenerateRulesForMSBuild(output_dir, options, spec,
                                                                                   sources, excluded_sources,
                                                                                   props_files_of_rules, targets_files_of_rules,
                                                                                   actions_to_add, extension_to_rule_name):
                                                        # MSBuild rules are implemented using three files: an XML file, a .targets
                                                      Severity: Minor
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.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 _MapFileToMsBuildSourceType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      def _MapFileToMsBuildSourceType(source, extension_to_rule_name):
                                                        """Returns the group and element type of the source file.
                                                      
                                                        Arguments:
                                                            source: The source file name.
                                                      Severity: Minor
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.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 _GetPrecompileRelatedFiles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      def _GetPrecompileRelatedFiles(spec):
                                                        # Gather a list of precompiled header related sources.
                                                        precompiled_related = []
                                                        for _, config in spec['configurations'].iteritems():
                                                          for k in precomp_keys:
                                                      Severity: Minor
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.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

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                        for build_file, build_file_dict in data.iteritems():
                                                          (build_file_root, build_file_ext) = os.path.splitext(build_file)
                                                          if build_file_ext != '.gyp':
                                                            continue
                                                          sln_path = build_file_root + options.suffix + '.sln'
                                                      Severity: Major
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.py and 1 other location - About 4 hrs to fix
                                                      tools/gyp/pylib/gyp/generator/xcode.py on lines 562..568

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 81.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                      def _EscapeCppDefineForMSVS(s):
                                                        """Escapes a CPP define so that it will reach the compiler unaltered."""
                                                        s = _EscapeEnvironmentVariableExpansion(s)
                                                        s = _EscapeCommandLineArgumentForMSVS(s)
                                                        s = _EscapeVCProjCommandLineArgListItem(s)
                                                      Severity: Major
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.py and 1 other location - About 2 hrs to fix
                                                      tools/gyp/pylib/gyp/generator/msvs.py on lines 817..825

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 61.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                      def _EscapeCppDefineForMSBuild(s):
                                                        """Escapes a CPP define so that it will reach the compiler unaltered."""
                                                        s = _EscapeEnvironmentVariableExpansion(s)
                                                        s = _EscapeCommandLineArgumentForMSBuild(s)
                                                        s = _EscapeMSBuildSpecialCharacters(s)
                                                      Severity: Major
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.py and 1 other location - About 2 hrs to fix
                                                      tools/gyp/pylib/gyp/generator/msvs.py on lines 778..786

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 61.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                          if key not in self.map:
                                                            end = self.end
                                                            curr = end[1]
                                                            curr[2] = end[1] = self.map[key] = [key, curr, end]
                                                      Severity: Major
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.py and 1 other location - About 2 hrs to fix
                                                      tools/gyp/pylib/gyp/ordered_dict.py on lines 75..78

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 50.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                          write_tlog_section = [
                                                              'WriteLinesToFile',
                                                              {'Condition': "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != "
                                                               "'true'" % (rule.tlog, rule.tlog),
                                                               'File': '$(IntDir)$(ProjectName).write.1.tlog',
                                                      Severity: Major
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.py and 1 other location - About 1 hr to fix
                                                      tools/gyp/pylib/gyp/generator/msvs.py on lines 2295..2300

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 42.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                          read_tlog_section = [
                                                              'WriteLinesToFile',
                                                              {'Condition': "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != "
                                                               "'true'" % (rule.tlog, rule.tlog),
                                                               'File': '$(IntDir)$(ProjectName).read.1.tlog',
                                                      Severity: Major
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.py and 1 other location - About 1 hr to fix
                                                      tools/gyp/pylib/gyp/generator/msvs.py on lines 2286..2292

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 42.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                      generator_default_variables = {
                                                          'EXECUTABLE_PREFIX': '',
                                                          'EXECUTABLE_SUFFIX': '.exe',
                                                          'STATIC_LIB_PREFIX': '',
                                                          'SHARED_LIB_PREFIX': '',
                                                      Severity: Major
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.py and 1 other location - About 1 hr to fix
                                                      tools/gyp/pylib/gyp/generator/cmake.py on lines 38..55

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 41.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                        path = path.replace('$(InputName)',
                                                                            os.path.splitext(os.path.split(input_file)[1])[0])
                                                      Severity: Major
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.py and 1 other location - About 1 hr to fix
                                                      tools/gyp/pylib/gyp/generator/msvs.py on lines 514..515

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 40.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                      Open

                                                        path = path.replace('$(InputExt)',
                                                                            os.path.splitext(os.path.split(input_file)[1])[1])
                                                      Severity: Major
                                                      Found in tools/gyp/pylib/gyp/generator/msvs.py and 1 other location - About 1 hr to fix
                                                      tools/gyp/pylib/gyp/generator/msvs.py on lines 511..512

                                                      Duplicated Code

                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                      Tuning

                                                      This issue has a mass of 40.

                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                      Refactorings

                                                      Further Reading

                                                      There are no issues that match your filters.

                                                      Category
                                                      Status