e-ucm/js-tracker

View on GitHub

Showing 23 of 45 total issues

Function TrackerAsset has 527 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function TrackerAsset() {

    this.settings = {
        host: 'https://rage.e-ucm.es/',
        port: 443,
Severity: Major
Found in src/js-tracker.js - About 2 days to fix

    Function TrackerAsset has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring.
    Open

    function TrackerAsset() {
    
        this.settings = {
            host: 'https://rage.e-ucm.es/',
            port: 443,
    Severity: Minor
    Found in src/js-tracker.js - About 2 days 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 js-tracker.js has 875 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright 2017 e-UCM, Universidad Complutense de Madrid
     *
     * Licensed under the Apache License, Version 2.0 (the 'License');
     * you may not use this file except in compliance with the License.
    Severity: Major
    Found in src/js-tracker.js - About 2 days to fix

      Function TraceResult has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
      Open

      TrackerEvent.TraceResult = function() {
          this.parent = null;
      
          this.Score = null;
          this.Success = null;
      Severity: Minor
      Found in src/js-tracker.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 TraceResult has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      TrackerEvent.TraceResult = function() {
          this.parent = null;
      
          this.Score = null;
          this.Success = null;
      Severity: Major
      Found in src/js-tracker.js - About 3 hrs to fix

        Function Geolocation has 79 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        TrackerPlugins.Geolocation = function() {
            this.interfaces = {
        
                Places:
                 function(tracker) {
        Severity: Major
        Found in plugins/geolocation.js - About 3 hrs to fix

          Function Geolocation has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          TrackerPlugins.Geolocation = function() {
              this.interfaces = {
          
                  Places:
                   function(tracker) {
          Severity: Minor
          Found in plugins/geolocation.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 Connect has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              this.Connect = function(callback) {
                  this.generateURL();
          
                  var tracker = this;
          
          
          Severity: Minor
          Found in src/js-tracker.js - About 1 hr to fix

            Function ToCsv has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                this.ToCsv = function() {
                    var success = (this.Success !== null) ? ',success,' + this.Success.toString() : '';
                    var completion = (this.Completion !== null) ? ',completion,' + this.Completion.toString() : '';
                    var response = (this.Response) ? ',response,' + this.Response.replaceAll(',', '\\,') : '';
                    var score = '';
            Severity: Minor
            Found in src/js-tracker.js - About 1 hr to fix

              Function TrackerEvent has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              function TrackerEvent (tracker) {
                  this.tracker = tracker;
              
                  this.TimeStamp = Date.now();
              
              
              Severity: Minor
              Found in src/js-tracker.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 TrackerEvent has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function TrackerEvent (tracker) {
                  this.tracker = tracker;
              
                  this.TimeStamp = Date.now();
              
              
              Severity: Minor
              Found in src/js-tracker.js - About 1 hr to fix

                Function addPlugin has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    this.addPlugin = function(plugin) {
                        var key = null;
                
                        for (key in plugin.functions) {
                            if (key in this) {
                Severity: Minor
                Found in src/js-tracker.js - About 1 hr to fix

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

                           function(tracker) {
                              this.tracker = tracker;
                  
                              this.PlaceType = {
                                  Building: 0,
                  Severity: Minor
                  Found in plugins/geolocation.js - About 1 hr to fix

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

                        this.SendAllTraces = function(traces, callback) {
                            var tracker = this;
                    
                            if (tracker.active) {
                                tracker.SendUnloggedTraces(function(unl_result, unl_error) {
                    Severity: Minor
                    Found in src/js-tracker.js - About 1 hr to fix

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

                          this.ProcessTraces = function(traces, format) {
                              var data = '';
                              var item;
                              var sb = [];
                      
                      
                      Severity: Minor
                      Found in src/js-tracker.js - About 1 hr to fix

                        Function Completable has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        var Completable = function(tracker) {
                        
                            this.tracker = tracker;
                        
                            this.CompletableType = {
                        Severity: Minor
                        Found in src/js-tracker.js - About 1 hr to fix

                          Function Completable has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          var Completable = function(tracker) {
                          
                              this.tracker = tracker;
                          
                              this.CompletableType = {
                          Severity: Minor
                          Found in src/js-tracker.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 SendPendingTraces has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              this.SendPendingTraces = function(callback) {
                                  var tracker = this;
                          
                                  // Try to send old traces
                                  if (tracker.tracesPending.length > 0) {
                          Severity: Minor
                          Found in src/js-tracker.js - About 1 hr to fix

                            Function DoFlush has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                this.DoFlush = function(callback) {
                                    var tracker = this;
                            
                                    tracker.CheckStatus(function(res, err) {
                                        if (err && res === 'Not active') {
                            Severity: Minor
                            Found in src/js-tracker.js - About 1 hr to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if (ismap(this.Extensions[key])) {
                                                          var smap = '';
                              
                                                          for (var k in this.Extensions[key]) {
                                                              if (typeof this.Extensions[key][k] === 'number') {
                              Severity: Major
                              Found in src/js-tracker.js - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language