Showing 1,896 of 2,859 total issues

Function _XcodeVersion has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def _XcodeVersion(self):
    # `xcodebuild -version` output looks like
    #    Xcode 4.6.3
    #    Build version 4H1503
    # or like
Severity: Minor
Found in tools/gyp/pylib/gyp/xcode_emulation.py - About 1 hr 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 rule has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def rule(self, name, command, description=None, depfile=None,
Severity: Major
Found in tools/gyp/pylib/gyp/ninja_syntax.py - About 1 hr to fix

    Function ProcessFile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def ProcessFile(filename, vlevel):
      """Does google-lint on a single file.
    
      Args:
        filename: The name of the file to parse.
    Severity: Minor
    Found in tools/cpplint.py - About 1 hr 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 WriteGraph has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def WriteGraph(edges):
      """Print a graphviz graph to stdout.
      |edges| is a map of target to a list of other targets it depends on."""
    
      # Bucket targets by file.
    Severity: Minor
    Found in tools/gyp/tools/graphviz.py - About 1 hr 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 memoize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def memoize(default=None):
      """This decorator caches the return value of a parameterless pure function"""
      def memoizer(func):
        val = []
        @functools.wraps(func)
    Severity: Minor
    Found in deps/v8/build/landmine_utils.py - About 1 hr 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 RunStep has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def RunStep(self):
        os.chdir(self["chrome_path"])
    
        trunk_releases = filter(lambda r: r["branch"] == "trunk", self["releases"])
        if not trunk_releases:  # pragma: no cover
    Severity: Minor
    Found in deps/v8/tools/push-to-trunk/releases.py - About 1 hr 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 CppLintWorker has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def CppLintWorker(command):
      try:
        process = subprocess.Popen(command, stderr=subprocess.PIPE)
        process.wait()
        out_lines = ""
    Severity: Minor
    Found in deps/v8/tools/presubmit.py - About 1 hr 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 FindObject has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def FindObject(self, tagged_address):
        if tagged_address in self.objects:
          return self.objects[tagged_address]
        if (tagged_address & self.ObjectAlignmentMask()) != 1: return None
        address = tagged_address - 1
    Severity: Minor
    Found in deps/v8/tools/grokdump.py - About 1 hr 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 format_disasm_line has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def format_disasm_line(
          self, f, start, line, next_address, highlight_address):
        line_address = start + line[0]
        address_fmt = "  <td>%s</td>\n"
        if line_address == highlight_address:
    Severity: Minor
    Found in deps/v8/tools/grokdump.py - About 1 hr 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 is_y2_used has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def is_y2_used(plot):
      for subplot in plot:
        if isinstance(subplot, Plot):
          for item in subplot.items:
            if item.axis == x1y2 or item.axis == x2y2:
    Severity: Minor
    Found in deps/v8/tools/gc-nvp-trace-processor.py - About 1 hr 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 _RunInternal has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def _RunInternal(self, jobs):
        pool = Pool(jobs)
        test_map = {}
        # TODO(machenbach): Instead of filling the queue completely before
        # pool.imap_unordered, make this a generator that already starts testing
    Severity: Minor
    Found in deps/v8/tools/testrunner/local/execution.py - About 1 hr 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 highlight has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function highlight(prefix, suffix, tag) {
      var nodeList = document.getElementsByTagName(tag);
      for (var i = 0; i < nodeList.length; i++) {
        var element = nodeList.item(i);
        var htmlClasses = sh_getClasses(element);
    Severity: Minor
    Found in doc/sh_main.js - About 1 hr to fix

      Function processKillAndExit has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        startup.processKillAndExit = function() {
      
          process.exit = function(code) {
            if (code || code === 0)
              process.exitCode = code;
      Severity: Minor
      Found in src/node.js - About 1 hr to fix

        Function defaultEval has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function defaultEval(code, context, file, cb) {
            var err, result;
            // first, create the Script object to check the syntax
            try {
              var script = vm.createScript(code, {
        Severity: Minor
        Found in lib/repl.js - About 1 hr to fix

          Function write has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          fs.write = function(fd, buffer, offset, length, position, callback) {
            function strWrapper(err, written) {
              // Retain a reference to buffer so that it can't be GC'ed too soon.
              callback(err, written || 0, buffer);
            }
          Severity: Minor
          Found in lib/fs.js - About 1 hr to fix

            Function Server has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function Server(options, connectionListener) {
              if (!(this instanceof Server))
                return new Server(options, connectionListener);
            
              events.EventEmitter.call(this);
            Severity: Minor
            Found in lib/net.js - About 1 hr to fix

              Function writeHead has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              ServerResponse.prototype.writeHead = function(statusCode, reason, obj) {
                var headers;
              
                if (util.isString(reason)) {
                  // writeHead(statusCode, reasonPhrase[, headers])
              Severity: Minor
              Found in lib/_http_server.js - About 1 hr to fix

                Function _addHeaderLine has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {
                  field = field.toLowerCase();
                  switch (field) {
                    // Array headers:
                    case 'set-cookie':
                Severity: Minor
                Found in lib/_http_incoming.js - About 1 hr to fix

                  Function queryServer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function queryServer(worker, message) {
                      var args = [message.address,
                                  message.port,
                                  message.addressType,
                                  message.fd];
                  Severity: Minor
                  Found in lib/cluster.js - About 1 hr to fix

                    Function addRequest has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Agent.prototype.addRequest = function(req, options) {
                      // Legacy API: addRequest(req, host, port, path)
                      if (typeof options === 'string') {
                        options = {
                          host: options,
                    Severity: Minor
                    Found in lib/_http_agent.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language