Showing 2,859 of 2,859 total issues

Function _ValidateSettings has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def _ValidateSettings(validators, settings, stderr):
  """Validates that the settings are valid for MSBuild or MSVS.

  We currently only validate the names of the settings, not their values.

Severity: Minor
Found in tools/gyp/pylib/gyp/MSVSSettings.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 ConvertToMSBuildSettings has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr):
  """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+).

  Args:
      msvs_settings: A dictionary.  The key is the tool name.  The values are
Severity: Minor
Found in tools/gyp/pylib/gyp/MSVSSettings.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 _GetXcodeEnv has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration,
                additional_settings=None):
  """Return the environment variables that Xcode would set. See
  http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW153
  for a full list.
Severity: Minor
Found in tools/gyp/pylib/gyp/xcode_emulation.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 ProcessOptions has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def ProcessOptions(options):
  global VERBOSE
  VERBOSE = options.verbose
  options.mode = options.mode.split(',')
  for mode in options.mode:
Severity: Minor
Found in tools/test.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 ReadMacros has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def ReadMacros(lines):
  constants = []
  macros = []
  for line in lines.split('\n'):
    hash = line.find('#')
Severity: Minor
Found in deps/v8/tools/js2c.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 JSMinify has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def JSMinify(self, text):
    """The main entry point.  Takes a text and returns a compressed version.

    The compressed version hopefully does the same thing.  Line breaks are
    preserved.
Severity: Minor
Found in deps/v8/tools/jsmin.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 ReadFileAndExpandMacros has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def ReadFileAndExpandMacros(filename):
  found_macros = {}
  expanded_lines = []
  with open(filename, "r") as f:
    found_macro = None
Severity: Minor
Found in deps/v8/tools/generate-runtime-tests.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

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

  def ExpandInputRoot(self, template, expansion, dirname):
    if '%(INPUT_ROOT)s' not in template and '%(INPUT_DIRNAME)s' not in template:
      return template
    path = template % {
        'INPUT_ROOT': expansion,
Severity: Major
Found in tools/gyp/pylib/gyp/generator/android.py and 1 other location - About 2 hrs to fix
tools/gyp/pylib/gyp/generator/make.py on lines 1877..1884

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

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

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

  def ExpandInputRoot(self, template, expansion, dirname):
    if '%(INPUT_ROOT)s' not in template and '%(INPUT_DIRNAME)s' not in template:
      return template
    path = template % {
        'INPUT_ROOT': expansion,
Severity: Major
Found in tools/gyp/pylib/gyp/generator/make.py and 1 other location - About 2 hrs to fix
tools/gyp/pylib/gyp/generator/android.py on lines 922..929

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

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

Function server has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var server = http.createServer(function (req, res) {
  var commands = req.url.split("/");
  var command = commands[1];
  var body = "";
  var arg = commands[2];
Severity: Major
Found in benchmark/http_simple_auto.js - About 2 hrs to fix

    Function runBlock4 has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function runBlock4() {
        for (var i = 0; i < 16; i++) {
          ''.replace(/\*/g, '');
          /\bnpgvir\b/.exec('npgvir');
          /sversbk/i.exec(s15[i]);
    Severity: Major
    Found in deps/v8/benchmarks/regexp.js - About 2 hrs to fix

      File js2c.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      #
      # Copyright 2006-2008 the V8 project authors. All rights reserved.
      # Redistribution and use in source and binary forms, with or without
      # modification, are permitted provided that the following conditions are
      Severity: Minor
      Found in tools/js2c.py - About 2 hrs to fix

        Function formatProperty has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
          var name, str, desc;
          desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
          if (desc.get) {
            if (desc.set) {
        Severity: Major
        Found in lib/util.js - About 2 hrs to fix

          Function unescapeBuffer has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          QueryString.unescapeBuffer = function(s, decodeSpaces) {
            var out = new Buffer(s.length);
            var state = 'CHAR'; // states: CHAR, HEX0, HEX1
            var n, m, hexchar;
          
          
          Severity: Major
          Found in lib/querystring.js - About 2 hrs to fix

            Function emit has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            EventEmitter.prototype.emit = function emit(type) {
              var er, handler, len, args, i, listeners;
            
              if (!this._events)
                this._events = {};
            Severity: Major
            Found in lib/events.js - About 2 hrs to fix

              Function prettify has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function prettify (data, args) {
                var searchsort = (npm.config.get("searchsort") || "NAME").toLowerCase()
                  , sortField = searchsort.replace(/^\-+/, "")
                  , searchRev = searchsort.charAt(0) === "-"
                  , truncate = !npm.config.get("long")
              Severity: Major
              Found in deps/npm/lib/search.js - About 2 hrs to fix

                AndroidMkWriter has 21 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class AndroidMkWriter(object):
                  """AndroidMkWriter packages up the writing of one target-specific Android.mk.
                
                  Its only real entry point is Write(), and is mostly used for namespacing.
                  """
                Severity: Minor
                Found in tools/gyp/pylib/gyp/generator/android.py - About 2 hrs to fix

                  Map has 21 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Map(HeapObject):
                    def Decode(self, offset, size, value):
                      return (value >> offset) & ((1 << size) - 1)
                  
                    # Instance Sizes
                  Severity: Minor
                  Found in deps/v8/tools/grokdump.py - About 2 hrs to fix

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

                    MINIDUMP_THREAD = Descriptor([
                      ("id", ctypes.c_uint32),
                      ("suspend_count", ctypes.c_uint32),
                      ("priority_class", ctypes.c_uint32),
                      ("priority", ctypes.c_uint32),
                    Severity: Major
                    Found in deps/v8/tools/grokdump.py and 1 other location - About 2 hrs to fix
                    deps/v8/tools/grokdump.py on lines 182..189

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

                    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

                          for library_dir in configuration.get('library_dirs', []):
                            if library_dir not in xcode_standard_library_dirs and (
                                not xcbc.HasBuildSetting(_library_search_paths_var) or
                                library_dir not in xcbc.GetBuildSetting(_library_search_paths_var)):
                              xcbc.AppendBuildSetting(_library_search_paths_var, library_dir)
                    Severity: Major
                    Found in tools/gyp/pylib/gyp/generator/xcode.py and 1 other location - About 2 hrs to fix
                    tools/gyp/pylib/gyp/generator/xcode.py on lines 1181..1184

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language