Showing 2,859 of 2,859 total issues

Function __RenderFlagList has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def __RenderFlagList(self, flaglist, output_lines, prefix="  "):
    fl = self.FlagDict()
    special_fl = _SPECIAL_FLAGS.FlagDict()
    flaglist = [(flag.name, flag) for flag in flaglist]
    flaglist.sort()
Severity: Minor
Found in tools/closure_linter/gflags.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 _GetExpectedMessages has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def _GetExpectedMessages(self, stream):
    """Parse a file and get a sorted list of expected messages."""
    messages = []
    for i, line in enumerate(stream):
      match = self._EXPECTED_RE.search(line)
Severity: Minor
Found in tools/closure_linter/closure_linter/common/filetestcase.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 WriteAndroidNdkModuleRule has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps):
    """Write a set of LOCAL_XXX definitions for Android NDK.

    These variable definitions will be used by Android NDK but do nothing for
    non-Android applications.
Severity: Minor
Found in tools/gyp/pylib/gyp/generator/make.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 WriteOnDiff has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def WriteOnDiff(filename):
  """Write to a file only if the new contents differ.

  Arguments:
    filename: name of the file to potentially write to.
Severity: Minor
Found in tools/gyp/pylib/gyp/common.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 _DetectVisualStudioVersions has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _DetectVisualStudioVersions(versions_to_check, force_express):
  """Collect the list of installed visual studio versions.

  Returns:
    A list of visual studio versions installed in descending order of
Severity: Minor
Found in tools/gyp/pylib/gyp/MSVSVersion.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 FindEnclosingBracketGroup has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def FindEnclosingBracketGroup(input_str):
  stack = []
  start = -1
  for index, char in enumerate(input_str):
    if char in LBRACKETS:
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 Tokenize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def Tokenize(self):
    self.tokens = [ ]
    while self.HasMore():
      self.SkipSpaces()
      if not self.HasMore():
Severity: Minor
Found in tools/test.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 MakeChangeLogBody has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def MakeChangeLogBody(commit_messages, auto_format=False):
  result = ""
  added_titles = set()
  for (title, body, author) in commit_messages:
    # TODO(machenbach): Better check for reverts. A revert should remove the
Severity: Minor
Found in deps/v8/tools/push-to-trunk/common_includes.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 ProcessOptions has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def ProcessOptions(options):
  global VARIANT_FLAGS

  # Architecture and mode related stuff.
  if options.arch_and_mode:
Severity: Minor
Found in deps/v8/tools/run-deopt-fuzzer.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 Update has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def Update():
  # Create directory for private data storage.
  data_dir = os.path.join(ROOT, "data")
  if not os.path.exists(data_dir):
    os.makedirs(data_dir)
Severity: Minor
Found in deps/v8/tools/test-server.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 PrintReport has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def PrintReport(tests):
  total = len(tests)
  skipped = timeout = nocrash = passes = fail_ok = fail = 0
  for t in tests:
    if "outcomes" not in dir(t) or not t.outcomes:
Severity: Minor
Found in deps/v8/tools/testrunner/local/verbose.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

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

    if end_address > region[0] + region[1]:
      end_address = region[0] + region[1]
Severity: Major
Found in deps/v8/tools/grokdump.py and 1 other location - About 2 hrs to fix
deps/v8/tools/grokdump.py on lines 2376..2377

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

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 end_address > region[0] + region[1]:
      end_address = region[0] + region[1]
Severity: Major
Found in deps/v8/tools/grokdump.py and 1 other location - About 2 hrs to fix
deps/v8/tools/grokdump.py on lines 2436..2437

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

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

function parseLists(input) {
  var state = null;
  var depth = 0;
  var output = [];
  output.links = input.links;
Severity: Major
Found in tools/doc/html.js - About 2 hrs to fix

    Function main has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function main(conf) {
      var dur = +conf.dur;
      var type = conf.type;
      var size = +conf.size;
      var encoding;
    Severity: Major
    Found in benchmark/fs/write-stream-throughput.js - About 2 hrs to fix

      Function runBlock5 has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function runBlock5() {
          for (var i = 0; i < 13; i++) {
            'purpx'.replace(re14, '');
            'purpx'.replace(re15, '');
            'pvgl'.replace(re14, '');
      Severity: Major
      Found in deps/v8/benchmarks/regexp.js - About 2 hrs to fix

        Function OD has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            .on("data", function OD (c) {
              // detect what it is.
              // Then, depending on that, we'll figure out whether it's
              // a single-file module, gzipped tarball, or naked tarball.
              // gzipped files all start with 1f8b08
        Severity: Major
        Found in deps/npm/lib/utils/tar.js - About 2 hrs to fix

          Function linkInstall has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function linkInstall (pkgs, cb) {
            asyncMap(pkgs, function (pkg, cb) {
              var t = path.resolve(npm.globalDir, "..")
                , pp = path.resolve(npm.globalDir, pkg)
                , rp = null
          Severity: Major
          Found in deps/npm/lib/link.js - About 2 hrs to fix

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

            Writer.prototype.write = function(chunk, encoding, cb) {
              this.received += chunk.length;
            
              if (typeof encoding === 'function')
                encoding();
            Severity: Major
            Found in benchmark/net/net-pipe.js and 2 other locations - About 2 hrs to fix
            benchmark/net/net-c2s.js on lines 51..60
            benchmark/net/net-s2c.js on lines 51..60

            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

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

            Writer.prototype.write = function(chunk, encoding, cb) {
              this.received += chunk.length;
            
              if (typeof encoding === 'function')
                encoding();
            Severity: Major
            Found in benchmark/net/net-c2s.js and 2 other locations - About 2 hrs to fix
            benchmark/net/net-pipe.js on lines 51..60
            benchmark/net/net-s2c.js on lines 51..60

            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

            Severity
            Category
            Status
            Source
            Language