Showing 2,859 of 2,859 total issues

Function FindRuntimeFunctions has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def FindRuntimeFunctions():
  inline_functions = FindInlineRuntimeFunctions()
  functions = []
  expanded_lines = ReadFileAndExpandMacros(FILENAME)
  function = None
Severity: Minor
Found in deps/v8/tools/generate-runtime-tests.py - About 4 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 ClassifyFunctions has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def ClassifyFunctions(functions):
  # Can be fuzzed with a JavaScript testcase.
  js_fuzzable_functions = []
  # We have enough information to fuzz these, but they need inputs that
  # cannot be created or passed around in JavaScript.
Severity: Minor
Found in deps/v8/tools/generate-runtime-tests.py - About 4 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 install has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function install (args, cb_) {
  var hasArguments = !!args.length

  function cb (er, installed) {
    if (er) return cb_(er)
Severity: Major
Found in deps/npm/lib/install.js - About 4 hrs to fix

    File ecmametadatapass.py has 341 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    #
    # Copyright 2010 The Closure Linter Authors. All Rights Reserved.
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    Severity: Minor
    Found in tools/closure_linter/closure_linter/ecmametadatapass.py - About 4 hrs to fix

      File stats-viewer.py has 341 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      #
      # Copyright 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 deps/v8/tools/stats-viewer.py - About 4 hrs to fix

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

              if slot == highlight_address:
                f.write("<tr class=\"highlight-line\">\n")
                address_fmt = "<a id=\"highlight\"></a>%s&nbsp;</td>\n"
              elif slot < highlight_address and highlight_address < slot + size:
                f.write("<tr class=\"inexact-highlight-line\">\n")
        Severity: Major
        Found in deps/v8/tools/grokdump.py and 1 other location - About 4 hrs to fix
        deps/v8/tools/grokdump.py on lines 2494..2502

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

        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 testBumpUpVersionBailout1(self):
            TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
            self._state["latest"] = "latest_hash"
        
            self.ExpectGit([
        Severity: Major
        Found in deps/v8/tools/push-to-trunk/test_scripts.py and 1 other location - About 4 hrs to fix
        deps/v8/tools/push-to-trunk/test_scripts.py on lines 1443..1452

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

        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 testBumpUpVersionBailout2(self):
            TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
            self._state["lkgr"] = "lkgr_hash"
        
            self.ExpectGit([
        Severity: Major
        Found in deps/v8/tools/push-to-trunk/test_scripts.py and 1 other location - About 4 hrs to fix
        deps/v8/tools/push-to-trunk/test_scripts.py on lines 1430..1440

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

        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 line_address == highlight_address:
              f.write("<tr class=\"highlight-line\">\n")
              address_fmt = "  <td><a id=\"highlight\">%s</a></td>\n"
            elif (line_address < highlight_address and
                  highlight_address < next_address + start):
        Severity: Major
        Found in deps/v8/tools/grokdump.py and 1 other location - About 4 hrs to fix
        deps/v8/tools/grokdump.py on lines 2339..2346

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

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

        
        var CC = require("config-chain").ConfigChain
        var inherits = require("inherits")
        var configDefs = require("./defaults.js")
        var types = configDefs.types
        Severity: Minor
        Found in deps/npm/lib/config/core.js - About 4 hrs to fix

          Function collectData has 103 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            this.collectData = function(input, distortion_per_entry) {
          
              var last_timestamp = 0;
          
              // Parse functions.
          Severity: Major
          Found in deps/v8/tools/profviz/composer.js - About 4 hrs to fix

            Function isFullWidthCodePoint has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

            function isFullWidthCodePoint(code) {
              if (isNaN(code)) {
                return false;
              }
            
            
            Severity: Minor
            Found in lib/readline.js - About 4 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 28 (exceeds 5 allowed). Consider refactoring.
            Open

            var server = module.exports = http.createServer(function (req, res) {
              if (useDomains) {
                var dom = domain.create();
                dom.add(req);
                dom.add(res);
            Severity: Minor
            Found in benchmark/http_simple.js - About 4 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 GetClosurizedNamespace has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

              def GetClosurizedNamespace(self, identifier):
                """Given an identifier, returns the namespace that identifier is from.
            
                Args:
                  identifier: The identifier to extract a namespace from.
            Severity: Minor
            Found in tools/closure_linter/closure_linter/javascriptstatetracker.py - About 4 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 Finalize has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

              def Finalize(self, state, tokenizer_mode):
                """Perform all checks that need to occur after all lines are processed."""
                # Call the base class's Finalize function.
                super(JavaScriptLintRules, self).Finalize(state, tokenizer_mode)
            
            
            Severity: Minor
            Found in tools/closure_linter/closure_linter/javascriptlintrules.py - About 4 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 WriteTarget has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

              def WriteTarget(self, spec, config_name, config, link_deps, compile_deps):
                extra_link_deps = any(self.target_outputs.get(dep).Linkable()
                                      for dep in spec.get('dependencies', [])
                                      if dep in self.target_outputs)
                if spec['type'] == 'none' or (not link_deps and not extra_link_deps):
            Severity: Minor
            Found in tools/gyp/pylib/gyp/generator/ninja.py - About 4 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 CheckForIncludeWhatYouUse has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

            def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,
                                          io=codecs):
              """Reports for missing stl includes.
            
              This function will output warnings to make sure you are including the headers
            Severity: Minor
            Found in tools/cpplint.py - About 4 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 CheckForNonStandardConstructs has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

            def CheckForNonStandardConstructs(filename, clean_lines, linenum,
                                              class_state, error):
              """Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
            
              Complain about several constructs which gcc-2 accepts, but which are
            Severity: Minor
            Found in tools/cpplint.py - About 4 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 ClientRequest has 102 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function ClientRequest(options, cb) {
              var self = this;
              OutgoingMessage.call(self);
            
              if (util.isString(options)) {
            Severity: Major
            Found in lib/_http_client.js - About 4 hrs to fix

              Function runBlock3 has 102 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function runBlock3() {
                  for (var i = 0; i < 27; i++) {
                    s67[i].replace(/[A-Za-z]/g, '');
                  }
                  for (var i = 0; i < 23; i++) {
              Severity: Major
              Found in deps/v8/benchmarks/regexp.js - About 4 hrs to fix
                Severity
                Category
                Status
                Source
                Language