Showing 2,859 of 2,859 total issues

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

Buffer.prototype.writeFloatLE = function writeFloatLE(val, offset, noAssert) {
  val = +val;
  offset = offset >>> 0;
  if (!noAssert)
    checkFloat(this, val, offset, 4);
Severity: Major
Found in lib/buffer.js and 3 other locations - About 2 hrs to fix
lib/buffer.js on lines 938..945
lib/buffer.js on lines 948..955
lib/buffer.js on lines 958..965

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

function prefix (args, silent, cb) {
  if (typeof cb !== "function") cb = silent, silent = false
  if (!silent) console.log(npm.prefix)
  process.nextTick(cb.bind(this, null, npm.prefix))
}
Severity: Major
Found in deps/npm/lib/prefix.js and 1 other location - About 2 hrs to fix
deps/npm/lib/root.js on lines 7..11

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

  if (this.v1.mark == mark) {
    this.direction = (this.v2.mark != mark && Strength.stronger(this.strength, this.v2.walkStrength))
      ? Direction.FORWARD
      : Direction.NONE;
  }
Severity: Major
Found in deps/v8/benchmarks/deltablue.js and 1 other location - About 2 hrs to fix
deps/v8/benchmarks/deltablue.js on lines 362..366

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 4 locations. Consider refactoring.
Open

Buffer.prototype.writeFloatBE = function writeFloatBE(val, offset, noAssert) {
  val = +val;
  offset = offset >>> 0;
  if (!noAssert)
    checkFloat(this, val, offset, 4);
Severity: Major
Found in lib/buffer.js and 3 other locations - About 2 hrs to fix
lib/buffer.js on lines 928..935
lib/buffer.js on lines 948..955
lib/buffer.js on lines 958..965

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

File run_benchmarks_test.py has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# Copyright 2014 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

Severity: Minor
Found in deps/v8/tools/unittests/run_benchmarks_test.py - About 2 hrs to fix

    Function Buffer has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Buffer(subject, encoding) {
      if (!util.isBuffer(this))
        return new Buffer(subject, encoding);
    
      if (util.isNumber(subject)) {
    Severity: Major
    Found in lib/buffer.js - About 2 hrs to fix

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

      Interface.prototype.trySpawn = function(cb) {
        var self = this,
            breakpoints = this.breakpoints || [],
            port = exports.port,
            host = 'localhost',
      Severity: Minor
      Found in lib/_debugger.js - 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 removeAllListeners has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          function removeAllListeners(type) {
        var key, listeners;
      
        if (!this._events)
          return this;
      Severity: Minor
      Found in lib/events.js - 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 writeHead has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      ServerResponse.prototype.writeHead = function(statusCode, reason, obj) {
        var headers;
      
        if (util.isString(reason)) {
          // writeHead(statusCode, reasonPhrase[, headers])
      Severity: Minor
      Found in lib/_http_server.js - 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 format has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.format = function(f) {
        if (!isString(f)) {
          var objects = [];
          for (var i = 0; i < arguments.length; i++) {
            objects.push(inspect(arguments[i]));
      Severity: Minor
      Found in lib/util.js - 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 readFile has a Cognitive Complexity of 17 (exceeds 5 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: Minor
      Found in lib/fs.js - 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 pipe has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      Readable.prototype.pipe = function(dest, pipeOpts) {
        var src = this;
        var state = this._readableState;
      
        switch (state.pipesCount) {
      Severity: Minor
      Found in lib/_stream_readable.js - 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 ReadStream has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      function ReadStream(path, options) {
        if (!(this instanceof ReadStream))
          return new ReadStream(path, options);
      
        // a little bit bigger buffer and water marks by default
      Severity: Minor
      Found in lib/fs.js - 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 encode has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      QueryString.stringify = QueryString.encode = function(obj, sep, eq, options) {
        sep = sep || '&';
        eq = eq || '=';
      
        var encode = QueryString.escape;
      Severity: Minor
      Found in lib/querystring.js - 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 getFlatProfile has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      Profile.prototype.getFlatProfile = function(opt_label) {
        var counters = new CallTree();
        var rootLabel = opt_label || CallTree.ROOT_NODE_LABEL;
        var precs = {};
        precs[rootLabel] = 0;
      Severity: Minor
      Found in deps/v8/tools/profile.js - 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 RunSuites has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      BenchmarkSuite.RunSuites = function(runner) {
        var continuation = null;
        var suites = BenchmarkSuite.suites;
        var length = suites.length;
        BenchmarkSuite.scores = [];
      Severity: Minor
      Found in deps/v8/benchmarks/base.js - 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 get_ has a Cognitive Complexity of 17 (exceeds 5 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: Minor
      Found in deps/npm/lib/cache/caching-client.js - 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 _CheckLineLength has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def _CheckLineLength(self, last_token, state):
          """Checks whether the line is too long.
      
          Args:
            last_token: The last token in the line.
      Severity: Minor
      Found in tools/closure_linter/closure_linter/ecmalintrules.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 WriteSources has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def WriteSources(self, configs, deps, sources,
                         extra_outputs, extra_link_deps,
                         part_of_all, precompiled_header):
          """Write Makefile code for any 'sources' from the gyp input.
          These are source files necessary to build the current target.
      Severity: Minor
      Found in tools/gyp/pylib/gyp/generator/make.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:
          hash = line.find('#')
      Severity: Minor
      Found in 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

      Severity
      Category
      Status
      Source
      Language