Showing 2,859 of 2,859 total issues

Function checkServerIdentity has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.checkServerIdentity = function checkServerIdentity(host, cert) {
  // Create regexp to much hostnames
  function regexpify(host, wildcards) {
    // Add trailing dot (make hostnames uniform)
    if (!/\.$/.test(host)) host += '.';
Severity: Major
Found in lib/tls.js - About 3 hrs to fix

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

    Url.prototype.format = function() {
      var auth = this.auth || '';
      if (auth) {
        auth = encodeURIComponent(auth);
        auth = auth.replace(/%3A/i, ':');
    Severity: Minor
    Found in lib/url.js - 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 _processChunk has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    Zlib.prototype._processChunk = function(chunk, flushFlag, cb) {
      var availInBefore = chunk && chunk.length;
      var availOutBefore = this._chunkSize - this._offset;
      var inOff = 0;
    
    
    Severity: Minor
    Found in lib/zlib.js - 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 write has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    Buffer.prototype.write = function(string, offset, length, encoding) {
      // Buffer#write(string);
      if (util.isUndefined(offset)) {
        encoding = 'utf8';
        length = this.length;
    Severity: Minor
    Found in lib/buffer.js - 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 emit has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    EventEmitter.prototype.emit = function emit(type) {
      var er, handler, len, args, i, listeners;
    
      if (!this._events)
        this._events = {};
    Severity: Minor
    Found in lib/events.js - 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 unescapeBuffer has a Cognitive Complexity of 24 (exceeds 5 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: Minor
    Found in lib/querystring.js - 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 read has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    Readable.prototype.read = function(n) {
      debug('read', n);
      var state = this._readableState;
      var nOrig = n;
    
    
    Severity: Minor
    Found in lib/_stream_readable.js - 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 rayTrace has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        rayTrace: function(info, ray, scene, depth){
            // Calc ambient
            var color = Flog.RayTracer.Color.prototype.multiplyScalar(info.color, scene.background.ambience);
            var oldColor = color;
            var shininess = Math.pow(10, info.shape.material.gloss + 1);
    Severity: Minor
    Found in deps/v8/benchmarks/raytrace.js - 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 connect has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.connect = function(/* [port, host], options, cb */) {
      var args = normalizeConnectArgs(arguments);
      var options = args[0];
      var cb = args[1];
    
    
    Severity: Minor
    Found in lib/_tls_wrap.js - 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 exports has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function (args, cb) {
    var s = process.platform === "win32" ? " *" : " \u2605"
      , f = "\uFF0F"
      , b = "\uFF3C"
      , x = process.platform === "win32" ? " " : ""
    Severity: Minor
    Found in deps/npm/lib/xmas.js - 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 WriteRules has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def WriteRules(target_name, rules, extra_sources, extra_deps,
                   path_to_gyp, output):
      """Write CMake for the 'rules' in the target.
    
      Args:
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/cmake.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 _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 Copy has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      def Copy(self):
        """Make a copy of this object.
    
        The new object will have its own copy of lists and dicts.  Any XCObject
        objects owned by this object (marked "strong") will be copied in the
    Severity: Minor
    Found in tools/gyp/pylib/gyp/xcodeproj_file.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 ValidateRulesInTarget has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules):
      """Ensures that the rules sections in target_dict are valid and consistent,
      and determines which sources they apply to.
    
      Arguments:
    Severity: Minor
    Found in tools/gyp/pylib/gyp/input.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 AddOrGetFileByPath has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      def AddOrGetFileByPath(self, path, hierarchical):
        """Returns an existing or new file reference corresponding to path.
    
        If hierarchical is True, this method will create or use the necessary
        hierarchical group structure corresponding to path.  Otherwise, it will
    Severity: Minor
    Found in tools/gyp/pylib/gyp/xcodeproj_file.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 CheckForFunctionLengths has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def CheckForFunctionLengths(filename, clean_lines, linenum,
                                function_state, error):
      """Reports for long function bodies.
    
      For an overview why this is done, see:
    Severity: Minor
    Found in tools/cpplint.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 output_ascii has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      def output_ascii(self, f, start_address, end_address, highlight_address):
        region = self.reader.FindRegion(highlight_address)
        if region is None:
          f.write("<h3>Address %x not found in the dump.</h3>" %
              highlight_address)
    Severity: Minor
    Found in deps/v8/tools/grokdump.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

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

      if not shell_dir:
        if options.buildbot:
          shell_dir = os.path.join(workspace, options.outdir, mode)
          mode = mode.lower()
        else:
    Severity: Major
    Found in deps/v8/tools/run-tests.py and 1 other location - About 3 hrs to fix
    deps/v8/tools/run-deopt-fuzzer.py on lines 347..353

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

    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

      if not shell_dir:
        if options.buildbot:
          shell_dir = os.path.join(workspace, options.outdir, mode)
          mode = mode.lower()
        else:
    Severity: Major
    Found in deps/v8/tools/run-deopt-fuzzer.py and 1 other location - About 3 hrs to fix
    deps/v8/tools/run-tests.py on lines 449..455

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

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

    function Interface(stdin, stdout, args) {
      var self = this;
    
      this.stdin = stdin;
      this.stdout = stdout;
    Severity: Major
    Found in lib/_debugger.js - About 3 hrs to fix
      Severity
      Category
      Status
      Source
      Language