TJRoger/node-dota2-spectator

View on GitHub

Showing 24 of 26 total issues

Function analyze has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

exports.analyze = function(tokens) {
  var root = new exports.Node();
  
  while (tokens.length > 0) {
    var cur = tokens.shift();
Severity: Minor
Found in resources/steam_language_parser/parser/token_analyzer.js - About 5 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 parseInnerScope has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

function parseInnerScope(tokens, parent, root) {
  var scope1 = expect(tokens, 'operator', '{');
  var scope2 = optional(tokens, 'operator', '}');
  
  while (!scope2) {
Severity: Minor
Found in resources/steam_language_parser/parser/token_analyzer.js - About 3 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 analyze has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.analyze = function(tokens) {
  var root = new exports.Node();
  
  while (tokens.length > 0) {
    var cur = tokens.shift();
Severity: Major
Found in resources/steam_language_parser/parser/token_analyzer.js - About 2 hrs to fix

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

    exports.lookupSymbol = function(tree, identifier, strongonly) {
      var ident = identifierRegex.exec(identifier);
      
      if (!ident) {
        throw new Error("Invalid identifier specified " + identifier);
    Severity: Minor
    Found in resources/steam_language_parser/parser/symbol_locator.js - 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 parseInnerScope has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function parseInnerScope(tokens, parent, root) {
      var scope1 = expect(tokens, 'operator', '{');
      var scope2 = optional(tokens, 'operator', '}');
      
      while (!scope2) {
    Severity: Minor
    Found in resources/steam_language_parser/parser/token_analyzer.js - About 1 hr to fix

      Function Dota2Client has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var Dota2Client = function Dota2Client(user, gc, debug) {
          EventEmitter.call(this);
      
          this.debug = debug;
          this._client = user._client;
      Severity: Minor
      Found in index.js - About 1 hr to fix

        Function emitClassEncoder has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function emitClassEncoder(cnode, baseSize) {
          Steam.Internal[cnode.name].prototype.encode = function() {
            // first emit variable length members
            var varLengthProps = [];
            
        Severity: Minor
        Found in resources/steam_language_parser/generator/node_gen.js - About 1 hr to fix

          Function encode has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            Steam.Internal[cnode.name].prototype.encode = function() {
              // first emit variable length members
              var varLengthProps = [];
              
              cnode.childNodes.forEach(function(prop) {
          Severity: Minor
          Found in resources/steam_language_parser/generator/node_gen.js - About 1 hr to fix

            Function emitClassConstructor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function emitClassConstructor(cnode) {
              Steam.Internal[cnode.name] = function(object) {
                object = object || {};
                
                cnode.childNodes.forEach(function(prop) {
            Severity: Minor
            Found in resources/steam_language_parser/generator/node_gen.js - About 1 hr to fix

              Function getTypeSize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.getTypeSize = function(prop) {
                var sym = prop.type;
                
                // no static size for proto
                if (prop.flags == 'proto') {
              Severity: Minor
              Found in resources/steam_language_parser/code_generator.js - 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 emitClassDecoder has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function emitClassDecoder(cnode) {
                Steam.Internal[cnode.name].decode = function(buffer) {
                  if (!ByteBuffer.isByteBuffer(buffer)) {
                    buffer = ByteBuffer.wrap(buffer, ByteBuffer.LITTLE_ENDIAN);
                  }
              Severity: Minor
              Found in resources/steam_language_parser/generator/node_gen.js - About 1 hr to fix

                Function decode has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  Steam.Internal[cnode.name].decode = function(buffer) {
                    if (!ByteBuffer.isByteBuffer(buffer)) {
                      buffer = ByteBuffer.wrap(buffer, ByteBuffer.LITTLE_ENDIAN);
                    }
                    
                Severity: Minor
                Found in resources/steam_language_parser/generator/node_gen.js - About 1 hr to fix

                  Function lookupSymbol has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports.lookupSymbol = function(tree, identifier, strongonly) {
                    var ident = identifierRegex.exec(identifier);
                    
                    if (!ident) {
                      throw new Error("Invalid identifier specified " + identifier);
                  Severity: Minor
                  Found in resources/steam_language_parser/parser/symbol_locator.js - About 1 hr to fix

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

                    var Dota2Client = function Dota2Client(user, gc, debug) {
                        EventEmitter.call(this);
                    
                        this.debug = debug;
                        this._client = user._client;
                    Severity: Minor
                    Found in index.js - 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 tokenizeString has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    exports.tokenizeString = function(buffer) {
                      var match;
                    
                      var tokenList = [];
                      while ((match = regexPattern.exec(buffer))) {
                    Severity: Minor
                    Found in resources/steam_language_parser/parser/language_parser.js - 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 gcClientConnectionStatus has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    handlers[Dota2.EGCBaseClientMsg.k_EMsgGCClientConnectionStatus] = function gcClientConnectionStatus(message) {
                      /* Catch and handle changes in connection status, cuz reasons u know. */
                    
                      var status = Dota2.CMsgConnectionStatus.decode(message).status;
                      util.log(util.inspect(message, false, null));
                    Severity: Minor
                    Found in index.js - 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 getTypeOfSize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    exports.getTypeOfSize = function(size, unsigned) {
                      for (var key in weakTypeMap) {
                        if (weakTypeMap[key].size == size) {
                          if (unsigned && !weakTypeMap[key].signed)
                            return key;
                    Severity: Minor
                    Found in resources/steam_language_parser/code_generator.js - About 55 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

                    Function emitCode has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    exports.emitCode = function(root, gen, sb, nspace, supportsGC, internalFile) {
                    Severity: Minor
                    Found in resources/steam_language_parser/code_generator.js - About 45 mins to fix

                      Function onFriendsMessage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      var onFriendsMessage = function onFriendsMessage(source, message, type, chatter){
                          // respond to both chat room and private messages
                          if (type == 1) //1, message; 2, typing
                              if(friends.personaStates[source] != undefined){
                              console.log('Received message: ' +message+' from '+friends.personaStates[source].player_name);
                      Severity: Minor
                      Found in example.js - About 35 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

                      Function onGCToClientFindTopSourceTVGamesResponse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      handlers[Dota2.EDOTAGCMsg.k_EMsgGCToClientFindTopSourceTVGamesResponse] = function onGCToClientFindTopSourceTVGamesResponse(message, callback) {
                          callback = callback || null;
                          var topSourceTVGamesResponse = Dota2.CMsgGCToClientFindTopSourceTVGamesResponse.decode(message);
                          debuglog(topSourceTVGamesResponse, 'topSourceTVGamesResponse');
                          if (typeof topSourceTVGamesResponse.games != 'undefined' && topSourceTVGamesResponse.games.length > 0) {
                      Severity: Minor
                      Found in handlers/sourcetv.js - About 35 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

                      Severity
                      Category
                      Status
                      Source
                      Language