Showing 2,859 of 2,859 total issues

Function main has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def main(argv = None):
  """Main function.

  Args:
    argv: Sequence of command line arguments.
Severity: Minor
Found in tools/closure_linter/closure_linter/gjslint.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 WriteActions has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def WriteActions(self, actions, extra_sources, extra_outputs):
    """Write Makefile code for any 'actions' from the gyp input.

    extra_sources: a list that will be filled in with newly generated source
                   files, if any
Severity: Minor
Found in tools/gyp/pylib/gyp/generator/android.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 Assign has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def Assign(suites, peers):
  total_work = 0.0
  for s in suites:
    total_work += s.CalculateTotalDuration()

Severity: Minor
Found in deps/v8/tools/testrunner/network/distro.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

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

    if bad:
      self._HandleError(
          errors.GOOG_REQUIRES_NOT_ALPHABETIZED,
          'goog.require classes must be alphabetized.  The correct code is:\n' +
          '\n'.join(map(lambda x: 'goog.require(\'%s\');' % x,
Severity: Major
Found in tools/closure_linter/closure_linter/javascriptlintrules.py and 1 other location - About 3 hrs to fix
tools/closure_linter/closure_linter/javascriptlintrules.py on lines 326..333

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

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 __init__(self, properties=None, id=None, parent=None):
    # super
    XCObject.__init__(self, properties, id, parent)

    self._files_by_path = {}
Severity: Major
Found in tools/gyp/pylib/gyp/xcodeproj_file.py and 1 other location - About 3 hrs to fix
tools/gyp/pylib/gyp/xcodeproj_file.py on lines 1113..1119

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

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 bad:
      self._HandleError(
          errors.GOOG_PROVIDES_NOT_ALPHABETIZED,
          'goog.provide classes must be alphabetized.  The correct code is:\n' +
          '\n'.join(map(lambda x: 'goog.provide(\'%s\');' % x,
Severity: Major
Found in tools/closure_linter/closure_linter/javascriptlintrules.py and 1 other location - About 3 hrs to fix
tools/closure_linter/closure_linter/javascriptlintrules.py on lines 304..311

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

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 __init__(self, properties=None, id=None, parent=None):
    # super
    XCHierarchicalElement.__init__(self, properties, id, parent)
    self._children_by_path = {}
    self._variant_children_by_name_and_path = {}
Severity: Major
Found in tools/gyp/pylib/gyp/xcodeproj_file.py and 1 other location - About 3 hrs to fix
tools/gyp/pylib/gyp/xcodeproj_file.py on lines 1757..1764

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

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 GetMapFileName(self, config, expand_special):
    """Gets the explicitly overriden map file name for a target or returns None
    if it's not set."""
    config = self._TargetConfig(config)
    map_file = self._Setting(('VCLinkerTool', 'MapFileName'), config)
Severity: Major
Found in tools/gyp/pylib/gyp/msvs_emulation.py and 1 other location - About 3 hrs to fix
tools/gyp/pylib/gyp/msvs_emulation.py on lines 450..459

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

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 GetPGDName(self, config, expand_special):
    """Gets the explicitly overridden pgd name for a target or returns None
    if it's not overridden."""
    config = self._TargetConfig(config)
    output_file = self._Setting(
Severity: Major
Found in tools/gyp/pylib/gyp/msvs_emulation.py and 1 other location - About 3 hrs to fix
tools/gyp/pylib/gyp/msvs_emulation.py on lines 298..305

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

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 Interface has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Interface(input, output, completer, terminal) {
  if (!(this instanceof Interface)) {
    return new Interface(input, output, completer, terminal);
  }

Severity: Major
Found in lib/readline.js - About 3 hrs to fix

    Function readFile has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    fs.readFile = function(path, options, callback_) {
      var callback = maybeCallback(arguments[arguments.length - 1]);
    
      if (util.isFunction(options) || !options) {
        options = { encoding: null, flag: 'r' };
    Severity: Major
    Found in lib/fs.js - About 3 hrs to fix

      File lifecycle.js has 295 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      exports = module.exports = lifecycle
      exports.cmd = cmd
      exports.makeEnv = makeEnv
      
      var log = require("npmlog")
      Severity: Minor
      Found in deps/npm/lib/utils/lifecycle.js - About 3 hrs to fix

        Function DebugEventDetails has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function DebugEventDetails(response) {
          var details = {text:'', running:false};
        
          // Get the running state.
          details.running = response.running();
        Severity: Major
        Found in deps/v8/src/d8.js - About 3 hrs to fix

          Function defineDefaultCommands has 75 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function defineDefaultCommands(repl) {
            // TODO remove me after 0.3.x
            repl.defineCommand('break', {
              help: 'Sometimes you get stuck, this gets you out',
              action: function() {
          Severity: Major
          Found in lib/repl.js - About 3 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                  if (byte == 0x8b or           # mov
                      byte == 0x89 or           # mov reg-reg
                      (byte & 0xf0) == 0x50 or  # push/pop
                      (sixty_four and (byte & 0xf0) == 0x40) or  # rex prefix
                      byte == 0xc3 or           # return
            Severity: Critical
            Found in deps/v8/tools/grokdump.py - About 3 hrs to fix

              Function sc_format has 74 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function sc_format(s, args) {
                 var len = s.length;
                 var p = new sc_StringOutputPort();
                 var i = 0, j = 1;
              
              
              Severity: Major
              Found in deps/v8/benchmarks/earley-boyer.js - About 2 hrs to fix

                Function TickProcessor has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function TickProcessor(
                    cppEntriesProvider,
                    separateIc,
                    callGraphSize,
                    ignoreUnknown,
                Severity: Major
                Found in deps/v8/tools/tickprocessor.js - About 2 hrs to fix

                  File richards.js has 290 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // 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
                  // met:
                  //
                  Severity: Minor
                  Found in deps/v8/benchmarks/richards.js - About 2 hrs to fix

                    Function makeEnv has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function makeEnv (data, prefix, env) {
                      prefix = prefix || "npm_package_"
                      if (!env) {
                        env = {}
                        for (var i in process.env) if (!i.match(/^npm_/)) {
                    Severity: Major
                    Found in deps/npm/lib/utils/lifecycle.js - About 2 hrs to fix

                      Function get_ has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function get_ (uri, cachePath, params, cb) {
                        var staleOk = params.staleOk === undefined ? false : params.staleOk
                          , timeout = params.timeout === undefined ? -1 : params.timeout
                          , data    = params.data
                          , stat    = params.stat
                      Severity: Major
                      Found in deps/npm/lib/cache/caching-client.js - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language