Showing 1,896 of 2,859 total issues

Avoid deeply nested control flow statements.
Open

          if t in NON_JS_TYPES:
            decision = cctest_fuzzable_functions
          else:
            assert Generator.IsTypeSupported(t), \
                ("type generator not found for %s, function: %s" % (t, f))
Severity: Major
Found in deps/v8/tools/generate-runtime-tests.py - About 45 mins to fix

    Function run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def run(self):
        os.nice(20)
        self.ip = presence_handler.GetOwnIP()
        self.perf_data_manager = perfdata.PerfDataManager(self.datadir)
        self.perf_data_lock = threading.Lock()
    Severity: Minor
    Found in deps/v8/tools/testrunner/server/main.py - About 45 mins 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

    Avoid deeply nested control flow statements.
    Open

              if options.use_include_next:
                f.write('#include_next <%s>\n' % include_target)
              else:
                f.write('#include <%s>\n' % include_target)
    
    
    Severity: Major
    Found in deps/v8/tools/generate_shim_headers/generate_shim_headers.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                if options.define:
                  for define in options.define:
                    key, value = define.split('=', 1)
                    # This non-standard pop_macro extension is supported
                    # by compilers we support (GCC, clang).
      Severity: Major
      Found in deps/v8/tools/generate_shim_headers/generate_shim_headers.py - About 45 mins to fix

        Function _JSTypedArray has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def _JSTypedArray(self, name, recursion_budget):
            arraytype = random.choice(["Int8", "Int16", "Int32", "Uint8", "Uint16",
                                       "Uint32", "Float32", "Float64", "Uint8Clamped"])
            ctor_type = random.randint(0, 3)
            if ctor_type == 0:
        Severity: Minor
        Found in deps/v8/tools/generate-runtime-tests.py - About 45 mins 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

        Avoid deeply nested control flow statements.
        Open

                      if has_unexpected_output:
                        self.failed.append(test)
                        if test.output.HasCrashed():
                          self.crashed += 1
                      else:
        Severity: Major
        Found in deps/v8/tools/testrunner/network/network_execution.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                if env['CONTENT_LENGTH'].to_i == input_body.length
                  body = "Content-Length matches input length"
                  status = 200
                else
                  body = "Content-Length doesn't matches input length!
          Severity: Major
          Found in benchmark/http_simple.rb - About 45 mins to fix

            Function _ListenLocalConnection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def _ListenLocalConnection(self):
                release_lock_countdown = 1  # Pubkey.
                self.local_receiver = compression.Receiver(self.local_socket)
                while not self.local_receiver.IsDone():
                  data = self.local_receiver.Current()
            Severity: Minor
            Found in deps/v8/tools/testrunner/network/network_execution.py - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                  while chunk = env['rack.input'].read(512)
                    input_body << chunk
                  end
            Severity: Major
            Found in benchmark/http_simple.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        if include_after:
                          for header in include_after.split(':'):
                            f.write('#include %s\n' % header)
              
              
              Severity: Major
              Found in deps/v8/tools/generate_shim_headers/generate_shim_headers.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if line.strip() == "# Allocation failed - process out of memory":
                              oom = True
                              break
                        if oom: continue
                Severity: Major
                Found in deps/v8/tools/generate-runtime-tests.py - About 45 mins to fix

                  Function HasRun has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def HasRun(self, test, has_unexpected_output):
                      total = self.runner.succeeded + len(self.runner.failed)
                      if (total > 1) and (total % 50 == 1):
                        sys.stdout.write('\n')
                      if has_unexpected_output:
                  Severity: Minor
                  Found in deps/v8/tools/testrunner/local/progress.py - About 45 mins 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

                  Avoid deeply nested control flow statements.
                  Open

                              if time.time() >= end_time:
                                # Kill the process and wait for it to exit.
                                os.kill(process.pid, signal.SIGTERM)
                                exit_code = process.wait()
                                timed_out = True
                  Severity: Major
                  Found in deps/v8/tools/generate-runtime-tests.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                  with self.lock:
                                    print("\nPeer %s reports error: %s" % (peer.address, data[1]))
                                  continue
                    Severity: Major
                    Found in deps/v8/tools/testrunner/network/network_execution.py - About 45 mins to fix

                      Function _CheckoutRevision has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def _CheckoutRevision(self, base_svn_revision):
                          get_hash_cmd = (
                              "git log -1 --format=%%H --remotes --grep='^git-svn-id:.*@%s'" %
                              base_svn_revision)
                          try:
                      Severity: Minor
                      Found in deps/v8/tools/testrunner/server/work_handler.py - About 45 mins 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

                      Avoid deeply nested control flow statements.
                      Open

                                if include_before:
                                  for header in include_before.split(':'):
                                    f.write('#include %s\n' % header)
                      
                      
                      Severity: Major
                      Found in deps/v8/tools/generate_shim_headers/generate_shim_headers.py - About 45 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                          } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
                            return actual.source === expected.source &&
                                   actual.global === expected.global &&
                                   actual.multiline === expected.multiline &&
                                   actual.lastIndex === expected.lastIndex &&
                        Severity: Major
                        Found in lib/assert.js - About 40 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                            if ((shouldThrow && actual && expected &&
                                !expectedException(actual, expected)) || (!shouldThrow && actual)) {
                              throw actual;
                            }
                          Severity: Major
                          Found in lib/assert.js - About 40 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                              if (ctx.customInspect &&
                                  value &&
                                  isFunction(value.inspect) &&
                                  // Filter out the util module, it's inspect function is special
                                  value.inspect !== exports.inspect &&
                            Severity: Major
                            Found in lib/util.js - About 40 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                  if (opts.flush !== binding.Z_NO_FLUSH &&
                                      opts.flush !== binding.Z_PARTIAL_FLUSH &&
                                      opts.flush !== binding.Z_SYNC_FLUSH &&
                                      opts.flush !== binding.Z_FULL_FLUSH &&
                                      opts.flush !== binding.Z_FINISH &&
                              Severity: Major
                              Found in lib/zlib.js - About 40 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language