Showing 1,896 of 2,859 total issues

Function CheckLanguage has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
Open

def CheckLanguage(filename, clean_lines, linenum, file_extension, include_state,
                  error):
  """Checks rules from the 'C++ language rules' section of cppguide.html.

  Some of these rules are hard to test (function overloading, using
Severity: Minor
Found in tools/cpplint.py - About 1 day 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

File _tls_legacy.js has 625 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
Severity: Major
Found in lib/_tls_legacy.js - About 1 day to fix

    File _stream_readable.js has 608 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Copyright Joyent, Inc. and other Node contributors.
    //
    // Permission is hereby granted, free of charge, to any person obtaining a
    // copy of this software and associated documentation files (the
    // "Software"), to deal in the Software without restriction, including
    Severity: Major
    Found in lib/_stream_readable.js - About 1 day to fix

      Function ProcessListFiltersInDict has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
      Open

      def ProcessListFiltersInDict(name, the_dict):
        """Process regular expression and exclusion-based filters on lists.
      
        An exclusion list is in a dict key named with a trailing "!", like
        "sources!".  Every item in such a list is removed from the associated
      Severity: Minor
      Found in tools/gyp/pylib/gyp/input.py - About 1 day 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 GenerateOutputForConfig has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
      Open

      def GenerateOutputForConfig(target_list, target_dicts, data, params,
                                  config_name):
        options = params['options']
        flavor = gyp.common.GetFlavor(params)
        generator_flags = params.get('generator_flags', {})
      Severity: Minor
      Found in tools/gyp/pylib/gyp/generator/ninja.py - About 1 day 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 _ProcessContext has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
      Open

        def _ProcessContext(self):
          """Process the context at the current token.
      
          Returns:
            The context that should be assigned to the current token, or None if
      Severity: Minor
      Found in tools/closure_linter/closure_linter/ecmametadatapass.py - About 1 day 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 WriteLinkForArch has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
      Open

        def WriteLinkForArch(self, ninja_file, spec, config_name, config,
                             link_deps, arch=None):
          """Write out a link step. Fills out target.binary. """
          command = {
            'executable':      'link',
      Severity: Minor
      Found in tools/gyp/pylib/gyp/generator/ninja.py - About 1 day 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 connectionListener has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
      Open

      function connectionListener(socket) {
        var self = this;
        var outgoing = [];
        var incoming = [];
      
      
      Severity: Minor
      Found in lib/_http_server.js - About 1 day 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 CheckToken has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
      Open

        def CheckToken(self, token, state):
          """Checks a token for indentation errors.
      
          Args:
            token: The current token under consideration
      Severity: Minor
      Found in tools/closure_linter/closure_linter/indentation.py - About 1 day 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 __call__ has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
      Open

        def __call__(self, argv):
          """Parses flags from argv; stores parsed flags into this FlagValues object.
      
          All unparsed arguments are returned.  Flags are parsed using the GNU
          Program Argument Syntax Conventions, using getopt:
      Severity: Minor
      Found in tools/closure_linter/gflags.py - About 1 day 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 _AddSources2 has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
      Open

      def _AddSources2(spec, sources, exclusions, grouped_sources,
                       extension_to_rule_name, sources_handled_by_action,
                       list_excluded):
        extensions_excluded_from_precompile = []
        for source in sources:
      Severity: Minor
      Found in tools/gyp/pylib/gyp/generator/msvs.py - About 1 day 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 GeneratorMain has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
      Open

      def GeneratorMain(argv):
        parser = optparse.OptionParser()
        parser.add_option('--headers-root', action='append')
        parser.add_option('--define', action='append')
        parser.add_option('--output-directory')
      Severity: Minor
      Found in deps/v8/tools/generate_shim_headers/generate_shim_headers.py - About 1 day 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

      File node.js has 559 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Copyright Joyent, Inc. and other Node contributors.
      //
      // Permission is hereby granted, free of charge, to any person obtaining a
      // copy of this software and associated documentation files (the
      // "Software"), to deal in the Software without restriction, including
      Severity: Major
      Found in src/node.js - About 1 day to fix

        Function errorHandler has 232 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function errorHandler (er) {
          // console.error("errorHandler", er)
          if (!npm.config || !npm.config.loaded) {
            // logging won't work unless we pretend that it's ready
            er = er || new Error("Exit prior to config file resolving.")
        Severity: Major
        Found in deps/npm/lib/utils/error-handler.js - About 1 day to fix

          File util.js has 551 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // Copyright Joyent, Inc. and other Node contributors.
          //
          // Permission is hereby granted, free of charge, to any person obtaining a
          // copy of this software and associated documentation files (the
          // "Software"), to deal in the Software without restriction, including
          Severity: Major
          Found in lib/util.js - About 1 day to fix

            Function masterInit has 228 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function masterInit() {
              cluster.workers = {};
            
              var intercom = new EventEmitter;
              cluster.settings = {};
            Severity: Major
            Found in lib/cluster.js - About 1 day to fix

              Consider simplifying this complex logical expression.
              Open

                if (code >= 0x1100 && (
                    code <= 0x115f ||  // Hangul Jamo
                    0x2329 === code || // LEFT-POINTING ANGLE BRACKET
                    0x232a === code || // RIGHT-POINTING ANGLE BRACKET
                    // CJK Radicals Supplement .. Enclosed CJK Letters and Months
              Severity: Critical
              Found in lib/readline.js - About 1 day to fix

                XcodeSettings has 62 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class XcodeSettings(object):
                  """A class that understands the gyp 'xcode_settings' object."""
                
                  # Populated lazily by _SdkPath(). Shared by all XcodeSettings, so cached
                  # at class-level for efficiency.
                Severity: Major
                Found in tools/gyp/pylib/gyp/xcode_emulation.py - About 1 day to fix

                  Function masterInit has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function masterInit() {
                    cluster.workers = {};
                  
                    var intercom = new EventEmitter;
                    cluster.settings = {};
                  Severity: Minor
                  Found in lib/cluster.js - About 1 day 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 setupChannel has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function setupChannel(target, channel) {
                    target._channel = channel;
                    target._handleQueue = null;
                  
                    var decoder = new StringDecoder('utf8');
                  Severity: Minor
                  Found in lib/child_process.js - About 1 day 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

                  Severity
                  Category
                  Status
                  Source
                  Language