Showing 2,859 of 2,859 total issues

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

  child.stderr.addListener('data', function(chunk) {
    stderrLen += chunk.length;

    if (stderrLen > options.maxBuffer) {
      ex = new Error('stderr maxBuffer exceeded.');
Severity: Major
Found in lib/child_process.js and 1 other location - About 2 hrs to fix
lib/child_process.js on lines 790..802

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

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

  child.stdout.addListener('data', function(chunk) {
    stdoutLen += chunk.length;

    if (stdoutLen > options.maxBuffer) {
      ex = new Error('stdout maxBuffer exceeded.');
Severity: Major
Found in lib/child_process.js and 1 other location - About 2 hrs to fix
lib/child_process.js on lines 804..816

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

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 dedupe.js has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// traverse the node_modules/package.json tree
// looking for duplicates.  If any duplicates are found,
// then move them up to the highest level necessary
// in order to make them no longer duplicated.
//
Severity: Minor
Found in deps/npm/lib/dedupe.js - About 2 hrs to fix

    File gc-nvp-trace-processor.py has 289 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    #
    # Copyright 2010 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 deps/v8/tools/gc-nvp-trace-processor.py - About 2 hrs to fix

      Function _storeHeader has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      OutgoingMessage.prototype._storeHeader = function(firstLine, headers) {
        // firstLine in the case of request is: 'GET /index.html HTTP/1.1\r\n'
        // in the case of response it is: 'HTTP/1.1 200 OK\r\n'
        var state = {
          sentConnectionHeader: false,
      Severity: Major
      Found in lib/_http_outgoing.js - About 2 hrs to fix

        Function readFileSync has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        fs.readFileSync = function(path, options) {
          if (!options) {
            options = { encoding: null, flag: 'r' };
          } else if (util.isString(options)) {
            options = { encoding: options, 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 _createServerHandle has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            function(address, port, addressType, fd) {
          var err = 0;
          // assign handle in listen, and clean up if bind or listen fails
          var handle;
        
        
        Severity: Minor
        Found in lib/net.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 server has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        function server() {
          var serverHandle = new TCP();
          var err = serverHandle.bind('127.0.0.1', PORT);
          if (err)
            fail(err, 'bind');
        Severity: Minor
        Found in benchmark/net/tcp-raw-s2c.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 write has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        OutgoingMessage.prototype.write = function(chunk, encoding, callback) {
          var self = this;
        
          if (this.finished) {
            var err = new Error('write after end');
        Severity: Minor
        Found in lib/_http_outgoing.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 setOptions has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        Server.prototype.setOptions = function(options) {
          if (util.isBoolean(options.requestCert)) {
            this.requestCert = options.requestCert;
          } else {
            this.requestCert = false;
        Severity: Minor
        Found in lib/_tls_wrap.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 targetResolver has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        function targetResolver (where, context, deps, devDeps) {
          var alreadyInstalledManually = []
            , resolveLeft = 0
            , nm = path.resolve(where, "node_modules")
            , parent = context.parent
        Severity: Minor
        Found in deps/npm/lib/install.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 __TokenizeLine has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          def __TokenizeLine(self, line):
            """Tokenizes the given line.
        
            Args:
              line: The contents of the line.
        Severity: Minor
        Found in tools/closure_linter/closure_linter/common/tokenizer.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 ComputeAndroidLibraryModuleNames has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          def ComputeAndroidLibraryModuleNames(self, libraries):
            """Compute the Android module names from libraries, ie spec.get('libraries')
        
            Args:
              libraries: the value of spec.get('libraries')
        Severity: Minor
        Found in tools/gyp/pylib/gyp/generator/android.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 GenerateOutput has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        def GenerateOutput(target_list, target_dicts, data, params):
          options = params['options']
          generator_flags = params.get('generator_flags', {})
          builddir_name = generator_flags.get('output_dir', 'out')
          limit_to_target_all = generator_flags.get('limit_to_target_all', False)
        Severity: Minor
        Found in tools/gyp/pylib/gyp/generator/android.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 RemoveSelfDependencies has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        def RemoveSelfDependencies(targets):
          """Remove self dependencies from targets that have the prune_self_dependency
          variable set."""
          for target_name, target_dict in targets.iteritems():
            for dependency_key in dependency_sections:
        Severity: Minor
        Found in tools/gyp/pylib/gyp/input.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 CheckForHeaderGuard has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        def CheckForHeaderGuard(filename, lines, error):
          """Checks that the file contains a header guard.
        
          Logs an error if no #ifndef header guard is present.  For other
          headers, checks that the full pathname is used.
        Severity: Minor
        Found in tools/cpplint.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 RegenerateFlags has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        def RegenerateFlags(options):
          """Given a parsed options object, and taking the environment variables into
          account, returns a list of flags that should regenerate an equivalent options
          object (even in the absence of the environment variables.)
        
        
        Severity: Minor
        Found in tools/gyp/pylib/gyp/__init__.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 Main has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        def Main(args):
          parser = optparse.OptionParser()
          parser.add_option("--arch",
                            help=("The architecture to run tests for, "
                                  "'auto' or 'native' for auto-detect"),
        Severity: Minor
        Found in deps/v8/tools/run_benchmarks.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

        Method call has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          def call(env)
            path = env['PATH_INFO'] || env['REQUEST_URI']
            commands = path.split('/')
        
            @count += 1
        Severity: Minor
        Found in benchmark/http_simple.rb - 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 EscapeCommand(command):
          parts = []
          for part in command:
            if ' ' in part:
              # Escape spaces.  We may need to escape more characters for this
        Severity: Major
        Found in tools/test.py and 1 other location - About 2 hrs to fix
        deps/v8/tools/testrunner/local/progress.py on lines 40..49

        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

        Severity
        Category
        Status
        Source
        Language