e-ucm/js-tracker

View on GitHub

Showing 45 of 45 total issues

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

    this.Initialized = function(completableId, type) {
        if (typeof type === 'undefined') {type = 8;}

        return this.tracker.Trace('initialized',this.CompletableType.properties[type],completableId);
    };
Severity: Major
Found in src/js-tracker.js and 6 other locations - About 1 hr to fix
plugins/geolocation.js on lines 62..66
plugins/geolocation.js on lines 68..72
src/js-tracker.js on lines 981..985
src/js-tracker.js on lines 987..991
src/js-tracker.js on lines 1076..1080
src/js-tracker.js on lines 1082..1086

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

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 7 locations. Consider refactoring.
Open

    this.Skipped = function(accessibleId, type) {
        if (typeof type === 'undefined') {type = 4;}

        return this.tracker.Trace('skipped',this.AccessibleType.properties[type],accessibleId);
    };
Severity: Major
Found in src/js-tracker.js and 6 other locations - About 1 hr to fix
plugins/geolocation.js on lines 62..66
plugins/geolocation.js on lines 68..72
src/js-tracker.js on lines 981..985
src/js-tracker.js on lines 1040..1044
src/js-tracker.js on lines 1076..1080
src/js-tracker.js on lines 1082..1086

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

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 7 locations. Consider refactoring.
Open

    this.Interacted = function(gameobjectId, type) {
        if (typeof type === 'undefined') {type = 3;}

        return this.tracker.Trace('interacted',this.GameObjectType.properties[type],gameobjectId);
    };
Severity: Major
Found in src/js-tracker.js and 6 other locations - About 1 hr to fix
plugins/geolocation.js on lines 62..66
plugins/geolocation.js on lines 68..72
src/js-tracker.js on lines 981..985
src/js-tracker.js on lines 987..991
src/js-tracker.js on lines 1040..1044
src/js-tracker.js on lines 1082..1086

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

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 7 locations. Consider refactoring.
Open

            this.Entered = function(placeId, type) {
                if (typeof type === 'undefined') {type = 5;}

                return this.tracker.Trace('entered',this.PlaceType.properties[type],placeId);
            };
Severity: Major
Found in plugins/geolocation.js and 6 other locations - About 1 hr to fix
plugins/geolocation.js on lines 68..72
src/js-tracker.js on lines 981..985
src/js-tracker.js on lines 987..991
src/js-tracker.js on lines 1040..1044
src/js-tracker.js on lines 1076..1080
src/js-tracker.js on lines 1082..1086

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

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 7 locations. Consider refactoring.
Open

            this.Exited = function(placeId, type) {
                if (typeof type === 'undefined') {type = 5;}

                return this.tracker.Trace('exited',this.PlaceType.properties[type],placeId);
            };
Severity: Major
Found in plugins/geolocation.js and 6 other locations - About 1 hr to fix
plugins/geolocation.js on lines 62..66
src/js-tracker.js on lines 981..985
src/js-tracker.js on lines 987..991
src/js-tracker.js on lines 1040..1044
src/js-tracker.js on lines 1076..1080
src/js-tracker.js on lines 1082..1086

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

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 7 locations. Consider refactoring.
Open

    this.Accessed = function(accessibleId, type) {
        if (typeof type === 'undefined') {type = 4;}

        return this.tracker.Trace('accessed',this.AccessibleType.properties[type],accessibleId);
    };
Severity: Major
Found in src/js-tracker.js and 6 other locations - About 1 hr to fix
plugins/geolocation.js on lines 62..66
plugins/geolocation.js on lines 68..72
src/js-tracker.js on lines 987..991
src/js-tracker.js on lines 1040..1044
src/js-tracker.js on lines 1076..1080
src/js-tracker.js on lines 1082..1086

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

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 7 locations. Consider refactoring.
Open

    this.Used = function(gameobjectId, type) {
        if (typeof type === 'undefined') {type = 3;}

        return this.tracker.Trace('used',this.GameObjectType.properties[type],gameobjectId);
    };
Severity: Major
Found in src/js-tracker.js and 6 other locations - About 1 hr to fix
plugins/geolocation.js on lines 62..66
plugins/geolocation.js on lines 68..72
src/js-tracker.js on lines 981..985
src/js-tracker.js on lines 987..991
src/js-tracker.js on lines 1040..1044
src/js-tracker.js on lines 1076..1080

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

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 2 locations. Consider refactoring.
Open

        for (key in plugin.functions) {
            if (key in this) {
                console.log('WARNING: Function ' + key + '() already exists in tracker, ignoring.');
                continue;
            }
Severity: Major
Found in src/js-tracker.js and 1 other location - About 1 hr to fix
src/js-tracker.js on lines 620..627

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

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

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

            for (key in plugin.interfaces) {
                if (key in this) {
                    console.log('WARNING: Interface ' + key + ' already exists, ignoring.');
                    continue;
                }
    Severity: Major
    Found in src/js-tracker.js and 1 other location - About 1 hr to fix
    src/js-tracker.js on lines 580..587

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

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

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

                            this.PlaceType = {
                                Building: 0,
                                GreenZone: 1,
                                UrbanArea: 2,
                                Water: 3,
                Severity: Minor
                Found in plugins/geolocation.js and 1 other location - About 55 mins to fix
                src/js-tracker.js on lines 998..1006

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

                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 2 locations. Consider refactoring.
                Open

                    this.AlternativeType = {
                        Question: 0,
                        Menu: 1,
                        Dialog: 2,
                        Path: 3,
                Severity: Minor
                Found in src/js-tracker.js and 1 other location - About 55 mins to fix
                plugins/geolocation.js on lines 31..40

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

                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) {
                            if (tracker.settings.debug && data.responseJSON) {
                                console.log(data.responseJSON);
                            }
                            callback(data, true);
                Severity: Minor
                Found in src/js-tracker.js and 1 other location - About 55 mins to fix
                src/js-tracker.js on lines 106..111

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

                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

                Severity
                Category
                Status
                Source
                Language