Showing 282 of 282 total issues

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

    private unloadDependencies(): void {
        const self = this;
        this.scripts.forEach((script) => {
            self.scriptLoader.unloadScript('head', script, true);
        });
Severity: Major
Found in src/modules/games/2048/2048.game.ts and 1 other location - About 1 hr to fix
src/modules/games/2048/2048.game.ts on lines 60..65

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

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 play has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public play(initial: boolean = false) {
        const self = this;
        this.setPlaybackSpeed(1);
        this.status = 'playing';
        if (initial) {
Severity: Minor
Found in src/_helpers/player.helper.ts - 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 reInitBroadcast has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public reInitBroadcast() {
        const $tv = this.getBroadcastVideo();
        if ($('#tv-stream').length && typeof videojs('tv-stream') !== 'undefined') {
            try {
                videojs('tv-stream').muted(false);
Severity: Minor
Found in src/_helpers/player.helper.ts - 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 preFlight has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private preFlight(callback): void {
        const self = this;
        window.onload = (function () {
            const $$video: any = self.broadcastVideo = document.getElementById("broadcastvideo");
            const $$appManager: any = self.appManager = document.getElementById("appmgr");
Severity: Minor
Found in src/app/bootstrap.ts - 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 pip has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    pip(start: boolean = true, callback?): void {
        const method = start ? 'addClass' : 'removeClass';
        $("#content")[method]('half');
        $('body')[method]('broadcast-half');
        if (start) {
Severity: Minor
Found in src/modules/stream/stream.module.ts - 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 prepareControls has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public prepareControls(): any {
        let events = this.events;
        for (let key in events) {
            if (typeof events[key]['key'] === 'undefined')
                events[key]['key'] = key;
Severity: Minor
Found in src/libs/module.ts - 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 getTextValue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    getTextValue(keycode) {
        if (keycode === this.key.ONE || keycode === 1) {
            return '1';
        } else if (keycode === this.key.TWO || keycode === 2) {
            return '2';
Severity: Minor
Found in src/_helpers/developer.ts - 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 updateNotifications has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    updateNotifications() {
        let errors = 0, networkErrors = 0;

        for (let i in this.consoleStack) {
            if (this.consoleStack[i].isError) {
Severity: Minor
Found in src/_helpers/developer.ts - 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 toConsole has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    toConsole(type, args) {
        let line, t;

        args = Array.prototype.slice.apply(args);

Severity: Minor
Found in src/_helpers/developer.ts - About 1 hr to fix

    Function TowerGameJS has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        window.TowerGameJS = function () {
            var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, e = t.width, n = t.height, i = t.canvasId, r = t.soundOn, a = new E({canvasId: i, highResolution: !0, width: e, height: n, soundOn: r}), o = function (t) {
                return "./assets/img/games/tower/".concat(t)
            };
            a.addImg("background", o("background.png")), a.addImg("hook", o("hook.png")), a.addImg("blockRope", o("block-rope.png")), a.addImg("block", o("block.png")), a.addImg("block-perfect", o("block-perfect.png"));
    Severity: Minor
    Found in src/assets/js/games/tower/main.js - About 1 hr to fix

      Function addTile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      HTMLActuator.prototype.addTile = function (tile) {
        var self = this;
      
        var wrapper   = document.createElement("div");
        var inner     = document.createElement("div");
      Severity: Minor
      Found in src/assets/js/games/2048/html_actuator.js - About 1 hr to fix

        Function js has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            js: function js(expression, options) {
              var data = options.data;
              var func;
              var execute = expression;
              ('index first last key').split(' ').forEach(function (prop) {
        Severity: Minor
        Found in src/_helpers/template7.js - About 1 hr to fix

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

              private unloadDependencies(): void {
                  const self = this;
                  this.scripts.forEach((script) => {
                      self.scriptLoader.unloadScript('body', script);
                  });
          Severity: Major
          Found in src/modules/games/tower/tower.game.ts and 1 other location - About 1 hr to fix
          src/modules/games/blockrain/blockrain.game.ts on lines 88..93

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

          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

              private unloadDependencies(): void {
                  const self = this;
                  this.scripts.forEach((script) => {
                      self.scriptLoader.unloadScript('body', script);
                  });
          Severity: Major
          Found in src/modules/games/blockrain/blockrain.game.ts and 1 other location - About 1 hr to fix
          src/modules/games/tower/tower.game.ts on lines 209..214

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

          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 arrayPolyfills has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function arrayPolyfills() {
              if (!Array.prototype.find) {
                  Object.defineProperty(Array.prototype, 'find', {
                      value: function (predicate) {
                          // 1. Let O be ? ToObject(this value).
          Severity: Minor
          Found in src/libs/run-polyfills.ts - About 1 hr to fix

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

                _create: function() {
            
                  var game = this;
            
                  this.theme(this.options.theme);
            Severity: Minor
            Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                          if (g(this, t), document.createElement("canvas").getContext) {
                              var n = e.canvasId, r = e.debug, a = e.width, o = e.height, s = e.highResolution, u = e.loadLimit, c = e.soundOn, l = a || window.innerWidth, h = o || window.innerHeight;
                              this.canvas = document.getElementById(n), s && (this.canvas.style.width = "".concat(l, "px"), this.canvas.style.height = "".concat(h, "px"), l *= 2, h *= 2), this.highResolution = s, this.canvas.width = l, this.canvas.height = h, this.width = this.canvas.width, this.height = this.canvas.height, this.calWidth = .5 * this.width, this.calHeight = .5 * this.height, this.debug = !!r, this.ctx = this.canvas.getContext("2d"), this.defaultLayer = "default", this.layerArr = [this.defaultLayer], this.instancesObj = {}, this.instancesObj[this.defaultLayer] = [], this.instancesReactionArr = [], this.utils = i, this.customVariable = {};
                              var f = this;
                              this.isTouchDevice = b(), this.debugArr = [], this.assetsObj = {image: {}, audio: {}}, this.assetsCount = {
              Severity: Major
              Found in src/assets/js/games/tower/main.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                            if (handler.mods.length === 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91] || modifiersMatch || handler.shortcut === '*') {
                                // Call the handler, if it is a modifier key, it will not be processed.
                                if (handler.method(event, handler) === false) {
                                    if (event.preventDefault) event.preventDefault(); else event.returnValue = false;
                                    if (event.stopPropagation) event.stopPropagation();
                Severity: Major
                Found in src/_helpers/hotkeys.js - About 1 hr to fix

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

                          for (var s = 1; s <= 8; s += 1) a.addImg("c".concat(s), o("c".concat(s, ".png")));
                  Severity: Major
                  Found in src/assets/js/games/tower/main.js and 1 other location - About 1 hr to fix
                  src/assets/js/games/tower/main.js on lines 1670..1670

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

                  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

                      public render(data: any = {}, callback?): void {
                          this.templateHelper.render(pollTemplate, { items: data }, this.$el, 'html', function () {
                              if (typeof callback === 'function')
                                  callback(data);
                          });
                  Severity: Major
                  Found in src/modules/poll/poll.module.ts and 1 other location - About 1 hr to fix
                  src/modules/program/program.module.ts on lines 42..47

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

                  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