e-ucm/js-tracker

View on GitHub

Showing 45 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

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

                  for (key in plugin.objects) {
                      if (typeof TrackerEvent.TraceObject.ObjectIDs[key] !== 'undefined') {
                          console.log('WARNING: Object ' + key + ' already exists in objects list, ignoring.');
                          continue;
                      }
          Severity: Major
          Found in src/js-tracker.js and 2 other locations - About 2 hrs to fix
          src/js-tracker.js on lines 590..597
          src/js-tracker.js on lines 610..617

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

          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

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

                  for (key in plugin.extensions) {
                      if (typeof TrackerEvent.TraceResult.ExtensionIDs[key] !== 'undefined') {
                          console.log('WARNING: Extension ' + key + ' already exists in extensions list, ignoring.');
                          continue;
                      }
          Severity: Major
          Found in src/js-tracker.js and 2 other locations - About 2 hrs to fix
          src/js-tracker.js on lines 590..597
          src/js-tracker.js on lines 600..607

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

          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

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

                  for (key in plugin.verbs) {
                      if (typeof TrackerEvent.TraceVerb.VerbIDs[key] !== 'undefined') {
                          console.log('WARNING: Verb ' + key + ' already exists in verbs list, ignoring.');
                          continue;
                      }
          Severity: Major
          Found in src/js-tracker.js and 2 other locations - About 2 hrs to fix
          src/js-tracker.js on lines 600..607
          src/js-tracker.js on lines 610..617

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

          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

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

              this.Selected = function(alternativeId, optionId, type) {
                  if (typeof type === 'undefined') {type = 5;}
          
                  this.tracker.setResponse(optionId);
                  return this.tracker.Trace('selected',this.AlternativeType.properties[type],alternativeId);
          Severity: Major
          Found in src/js-tracker.js and 3 other locations - About 2 hrs to fix
          plugins/geolocation.js on lines 84..90
          src/js-tracker.js on lines 1015..1020
          src/js-tracker.js on lines 1046..1051

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

          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

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

              this.Unlocked = function(alternativeId, optionId, type) {
                  if (typeof type === 'undefined') {type = 5;}
          
                  this.tracker.setResponse(optionId);
                  return this.tracker.Trace('unlocked',this.AlternativeType.properties[type],alternativeId);
          Severity: Major
          Found in src/js-tracker.js and 3 other locations - About 2 hrs to fix
          plugins/geolocation.js on lines 84..90
          src/js-tracker.js on lines 1008..1013
          src/js-tracker.js on lines 1046..1051

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

          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

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                      this.Followed = function(placeId, directions, type) {
                          if (typeof type === 'undefined') {type = 0;}
          
                          this.tracker.setLocation(location);
          
          
          Severity: Major
          Found in plugins/geolocation.js and 3 other locations - About 2 hrs to fix
          src/js-tracker.js on lines 1008..1013
          src/js-tracker.js on lines 1015..1020
          src/js-tracker.js on lines 1046..1051

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

          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

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

              this.Progressed = function(completableId, type, progress) {
                  if (typeof type === 'undefined') {type = 8;}
          
                  this.tracker.setProgress(progress);
                  return this.tracker.Trace('progressed',this.CompletableType.properties[type],completableId);
          Severity: Major
          Found in src/js-tracker.js and 3 other locations - About 2 hrs to fix
          plugins/geolocation.js on lines 84..90
          src/js-tracker.js on lines 1008..1013
          src/js-tracker.js on lines 1015..1020

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

          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

                   function (data) {
                      tracker.settings.userToken = 'Bearer ' + data.user.token;
                      if (tracker.settings.debug) {
                          console.info('AuthToken: ' + data.user.token);
                      }
          Severity: Major
          Found in src/js-tracker.js and 1 other location - About 2 hrs to fix
          src/js-tracker.js on lines 98..105

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

          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

                   function (data) {
                      tracker.settings.userToken = 'Bearer ' + data.user.token;
                      if (tracker.settings.debug) {
                          console.info('AuthToken: ' + data.user.token);
                      }
          Severity: Major
          Found in src/js-tracker.js and 1 other location - About 2 hrs to fix
          src/js-tracker.js on lines 119..126

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

          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 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
                Severity
                Category
                Status
                Source
                Language