Showing 2,859 of 2,859 total issues

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

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

                  if (!util.isBuffer(chunk) &&
                      !util.isString(chunk) &&
                      !util.isNullOrUndefined(chunk) &&
                      !state.objectMode) {
                    er = new TypeError('Invalid non-string/buffer chunk');
                Severity: Minor
                Found in lib/_stream_readable.js and 1 other location - About 45 mins to fix
                lib/_stream_writable.js on lines 184..194

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

                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 (!util.isBuffer(chunk) &&
                      !util.isString(chunk) &&
                      !util.isNullOrUndefined(chunk) &&
                      !state.objectMode) {
                    var er = new TypeError('Invalid non-string/buffer chunk');
                Severity: Minor
                Found in lib/_stream_writable.js and 1 other location - About 45 mins to fix
                lib/_stream_readable.js on lines 381..386

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

                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

                  } else {
                    this.v1.value = (this.v2.value - this.offset.value) / this.scale.value;
                  }
                Severity: Minor
                Found in deps/v8/benchmarks/deltablue.js and 1 other location - About 45 mins to fix
                deps/v8/benchmarks/deltablue.js on lines 488..490

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

                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

                    while current:
                      result += chr(current)
                      index += 1
                      current = self.data.ByteAt(index)
                Severity: Minor
                Found in deps/v8/tools/stats-viewer.py and 1 other location - About 45 mins to fix
                deps/v8/tools/stats-viewer.py on lines 349..352

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

                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

                      self.WriteLn('%s: LD_INPUTS := %s' % (
                          QuoteSpaces(self.output_binary),
                          ' '.join(map(QuoteSpaces, link_deps))))
                Severity: Minor
                Found in tools/gyp/pylib/gyp/generator/make.py and 1 other location - About 45 mins to fix
                tools/gyp/pylib/gyp/generator/make.py on lines 1557..1559

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

                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.direction == Direction.FORWARD) {
                    this.v2.value = this.v1.value * this.scale.value + this.offset.value;
                  } else {
                Severity: Minor
                Found in deps/v8/benchmarks/deltablue.js and 1 other location - About 45 mins to fix
                deps/v8/benchmarks/deltablue.js on lines 490..492

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

                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

                    while current:
                      result += chr(current)
                      index += 1
                      current = self.data.ByteAt(index)
                Severity: Minor
                Found in deps/v8/tools/stats-viewer.py and 1 other location - About 45 mins to fix
                deps/v8/tools/stats-viewer.py on lines 407..410

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

                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

                  for (var i = 0; i < length; i++) {
                    if (lowerFromParts[i] !== lowerToParts[i]) {
                      samePartsLength = i;
                      break;
                    }
                Severity: Minor
                Found in lib/path.js and 1 other location - About 45 mins to fix
                lib/path.js on lines 515..520

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

                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

                      dirs = set(dir for dir in (os.path.dirname(o) for o in outputs) if dir)
                Severity: Minor
                Found in tools/gyp/pylib/gyp/generator/cmake.py and 1 other location - About 45 mins to fix
                tools/gyp/pylib/gyp/generator/cmake.py on lines 275..275

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

                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

                    dirs = set(dir for dir in (os.path.dirname(o) for o in outputs) if dir)
                Severity: Minor
                Found in tools/gyp/pylib/gyp/generator/cmake.py and 1 other location - About 45 mins to fix
                tools/gyp/pylib/gyp/generator/cmake.py on lines 368..368

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

                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